all: stop using src/ dir, make tests reproducible, fix CI

This commit is contained in:
ge
2025-04-22 20:14:55 +03:00
parent e79f83f800
commit b7d5f4fcb1
7 changed files with 6 additions and 32 deletions

View File

@ -21,7 +21,4 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
# fuck this
sed -i tests/mymod_test.out -e 's/846284/83d954/g'
sed -i tests/mymod_test_bare_map.out -e 's/845da4/83d4b4/g'
v -stats test . v -stats test .

View File

@ -1,6 +1,4 @@
SRC_DIR ?= src DOC_DIR = doc
DOC_DIR ?= doc
TESTS_DIR ?= .
all: test all: test
@ -8,13 +6,14 @@ test:
v test $(TESTS_DIR) v test $(TESTS_DIR)
doc: doc:
v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR) v doc -f html -m . -o $(DOC_DIR)
serve: clean doc serve: clean doc
v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')" v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
clean: clean:
rm -r $(DOC_DIR) || true rm -r $(DOC_DIR) >/dev/null 2>&1 || true
rm mkembedfs >/dev/null 2>&1 || true
cli: build:
v cmd/mkembedfs -o mkembedfs v cmd/mkembedfs -o mkembedfs

View File

@ -1,7 +1,6 @@
module main module main
fn main() { fn main() {
println(embedfs)
$if bare_map ? { $if bare_map ? {
json_file := embedfs['assets/example.json'] or { EmbedFile{} } json_file := embedfs['assets/example.json'] or { EmbedFile{} }
println(json_file.data.to_string().trim_space()) println(json_file.data.to_string().trim_space())

View File

@ -1,12 +1 @@
EmbedFileSystem{
files: {'assets/example.json': EmbedFile{
data: embed_file.EmbedFileData{ len: 22, path: "assets/example.json", apath: "", uncompressed: 846284 }
meta: EmbedFileMetadata{
key: 'assets/example.json'
name: 'example.json'
ext: 'json'
mimetype: 'application/json'
}
}}
}
{"some": "JSON data"} {"some": "JSON data"}

View File

@ -20,7 +20,7 @@ fn test_mymod() {
fn test_mymod_bare_map() { fn test_mymod_bare_map() {
oldpwd := os.getwd() oldpwd := os.getwd()
expected_out := os.read_file('tests/mymod_test_bare_map.out')! expected_out := os.read_file('tests/mymod_test.out')!
os.chdir('tests/mymod')! os.chdir('tests/mymod')!
gen := embedfs.CodeGenerator{ gen := embedfs.CodeGenerator{
path: 'assets' path: 'assets'

View File

@ -1,10 +0,0 @@
{'assets/example.json': EmbedFile{
data: embed_file.EmbedFileData{ len: 22, path: "assets/example.json", apath: "", uncompressed: 845da4 }
meta: EmbedFileMetadata{
key: 'assets/example.json'
name: 'example.json'
ext: 'json'
mimetype: 'application/json'
}
}}
{"some": "JSON data"}