Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaoverton committed Jul 25, 2024
1 parent fd9f0bc commit 4a4e489
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,30 @@ target/release/nanobot: Cargo.* src/**
cargo build --release

TEST_TABLES = ldtab prefix statement
TEST_TSVS = $(foreach T,${TEST_TABLES},src/resources/test_data/${T}.tsv)
src/resources/test_data/zfa_excerpt.db: ${TEST_TSVS}
TEST_TSVS = $(foreach T,$(TEST_TABLES),src/resources/test_data/$(T).tsv)
src/resources/test_data/zfa_excerpt.db: $(TEST_TSVS)
rm -f $@
sqlite3 $@ ".mode tabs" \
$(foreach T,${TEST_TABLES},".import src/resources/test_data/${T}.tsv ${T}")
$(foreach T,$(TEST_TABLES),".import src/resources/test_data/$(T).tsv $(T)")

.PHONY: test
test: build/penguins/tables/.nanobot.db
EXAMPLES := table tables
EXAMPLE_DBS := $(foreach EXAMPLE,$(EXAMPLES),build/penguins/$(EXAMPLE)/.nanobot.db)

.PHONY: test-examples
test-examples: $(EXAMPLE_DBS)

.PHONY: test-code
test-code:
cargo fmt --check
cargo test

.PHONY: test-docs
test-docs:
PATH="$${PATH}:$$(pwd)/target/debug"; tesh --debug false ./doc

.PHONY: test
test: test-code test-examples test-docs

.PHONY: dev-check
dev-check:
find src/ tests/ | entr -rs 'cargo check --release'
Expand Down

0 comments on commit 4a4e489

Please sign in to comment.