This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
63 lines (50 loc) · 2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
include default.mk
GOOD_FEATURE_FILES = $(shell find ../testdata/good -name "*.feature" -o -name "*.feature.md")
BAD_FEATURE_FILES = $(shell find ../testdata/bad -name "*.feature" -o -name "*.feature.md")
ASTS = $(patsubst ../testdata/%,acceptance/testdata/%.ast.ndjson,$(GOOD_FEATURE_FILES))
PICKLES = $(patsubst ../testdata/%,acceptance/testdata/%.pickles.ndjson,$(GOOD_FEATURE_FILES))
SOURCES = $(patsubst ../testdata/%,acceptance/testdata/%.source.ndjson,$(GOOD_FEATURE_FILES))
ERRORS = $(patsubst ../testdata/%,acceptance/testdata/%.errors.ndjson,$(BAD_FEATURE_FILES))
GHERKIN = npx gherkin-javascript
.DELETE_ON_ERROR:
.codegen: src/Parser.ts
src/Parser.ts: gherkin-javascript.razor gherkin.berp
$(berp-generate-parser)
.tested: .compared
.compared: $(ASTS) $(PICKLES) $(ERRORS) $(SOURCES)
touch $@
acceptance/testdata/%.ast.ndjson: ../testdata/% ../testdata/%.ast.ndjson
mkdir -p $(@D)
$(GHERKIN) --no-source --no-pickles --predictable-ids $< | jq --sort-keys --compact-output "." > $@
ifndef GOLDEN
diff --unified <(jq "." $<.ast.ndjson) <(jq "." $@)
else
cp $@ $(word 2,$^)
endif
acceptance/testdata/%.pickles.ndjson: ../testdata/% ../testdata/%.pickles.ndjson
mkdir -p $(@D)
$(GHERKIN) --no-source --no-ast --predictable-ids $< | jq --sort-keys --compact-output "." > $@
ifndef GOLDEN
diff --unified <(jq "." $<.pickles.ndjson) <(jq "." $@)
else
cp $@ $(word 2,$^)
endif
acceptance/testdata/%.source.ndjson: ../testdata/% ../testdata/%.source.ndjson
mkdir -p $(@D)
$(GHERKIN) --no-ast --no-pickles --predictable-ids $< | jq --sort-keys --compact-output "." > $@
ifndef GOLDEN
diff --unified <(jq "." $<.source.ndjson) <(jq "." $@)
else
cp $@ $(word 2,$^)
endif
acceptance/testdata/%.errors.ndjson: ../testdata/% ../testdata/%.errors.ndjson
mkdir -p $(@D)
$(GHERKIN) --no-source --predictable-ids $< | jq --sort-keys --compact-output "." > $@
ifndef GOLDEN
diff --unified <(jq "." $<.errors.ndjson) <(jq "." $@)
else
cp $@ $(word 2,$^)
endif
clean:
rm -rf acceptance
.PHONY: clean