#Why does gleam_packages's codegen live in test/ dir?

1 messages · Page 1 of 1 (latest)

compact sorrel
#

Was reading thru the docs for Wisp and it linked to gleam_packages for reference as a complete app using wisp. Reading thru the "packages" repo, I noticed theres a sql/ directory. I was expecting to see Jak's squirrel package being used, but instead codegen.gleam from the test/ directory is being used. Why is it there?

rough pagoda
#

Probably so it won't ship with the package if it's used as a dep or downloaded from hex, etc.

proper harbor
#

Where else would it go?

compact sorrel
compact sorrel
#

So are dev tools/scripts usually placed in test/. In fact are most gleam scripts that get run with gleam run -m <file> placed in test/ usually? Is that the convention?

rough pagoda
#

Anything that isn't needed as part of a public api or shouldn't be distributed with the package. It's the only place to put it where Gleam will run it.

#

So yeah, dev-related gleam run -m-ables would tend to go there if you're not sharing them.

#

handbook.gleam goes there for my upcoming task runner too.

#

Which is a collection of tasks for your project.

ember atlas
#

I feel like a separate dev directory would be nice

rough pagoda
#

test is a bit of a misnomer when used in this way, but the dir also exists by convention, I suspect.

compact sorrel
#

yeah, well we're stuck with test now lucylaugh

ember atlas
#

I guess you could also always do a subdirectory in test too to make things clear

rough pagoda
#

Except for ffi, yeah (for now).

compact sorrel
#

Thanks for clearing this up guys!

proper harbor
#

I wonder if dev is a better name than test

rough pagoda
#

More generalized.

proper harbor
#

yeah

rough pagoda
#

Without further knowledge, it actually feels "wrong" to put anything other than tests in the test dir, like you're breaking the rules and may at some point face consequences

loud drum
compact sorrel
#

I assumed the test/codegen.gleam which did come up on a grep, was a test for the codegen... I then moved/renamed the file to realize gleam run checks src & test.

proper harbor
#

We wouldn't do it in a breaking way, nah

loud drum
#

So you'd keep add dev and keep test as an alias?

proper harbor
#

No details have been decided at all

#

But we don't do breaking changes

loud drum
#

Interesting, thx for the insight!

compact sorrel
loud drum
compact sorrel
#

iirc go has a similar commitment, but gets harder as "bugs" are fixed in the language. E.g. when go fixed something to do with iterators and people got upset

#

Specifically Go 1.23 Iterators

#

Which was a "breaking change" but got thru because it was a "bug" that often lead to confusion to newcomers

proper harbor
#

Our solution: don't add iterators 😎

ember atlas
#

I think dev is more clear

#

And it also fits with dev dependencies better

#

But would you put the tests in their own part of dev? Like dev/test?