diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8757eba..f9d8c51 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -21,7 +21,4 @@ jobs: - name: Run tests 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 . diff --git a/Makefile b/Makefile index 57330cf..de551cb 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ -SRC_DIR ?= src -DOC_DIR ?= doc -TESTS_DIR ?= . +DOC_DIR = doc all: test @@ -8,13 +6,14 @@ test: v test $(TESTS_DIR) doc: - v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR) + v doc -f html -m . -o $(DOC_DIR) serve: clean doc v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')" 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 diff --git a/src/embedfs.v b/embedfs.v similarity index 100% rename from src/embedfs.v rename to embedfs.v diff --git a/tests/mymod/main.v b/tests/mymod/main.v index 8f5867a..f2f56a2 100644 --- a/tests/mymod/main.v +++ b/tests/mymod/main.v @@ -1,7 +1,6 @@ module main fn main() { - println(embedfs) $if bare_map ? { json_file := embedfs['assets/example.json'] or { EmbedFile{} } println(json_file.data.to_string().trim_space()) diff --git a/tests/mymod_test.out b/tests/mymod_test.out index 32ac4b3..c25fd09 100644 --- a/tests/mymod_test.out +++ b/tests/mymod_test.out @@ -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"} diff --git a/tests/mymod_test.v b/tests/mymod_test.v index 0dbbd38..271e35a 100644 --- a/tests/mymod_test.v +++ b/tests/mymod_test.v @@ -20,7 +20,7 @@ fn test_mymod() { fn test_mymod_bare_map() { 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')! gen := embedfs.CodeGenerator{ path: 'assets' diff --git a/tests/mymod_test_bare_map.out b/tests/mymod_test_bare_map.out deleted file mode 100644 index 565c6c2..0000000 --- a/tests/mymod_test_bare_map.out +++ /dev/null @@ -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"}