Skip to content

Commit efa2e1e

Browse files
authored
DEV: Add tool to reset js/parse_tests data (#3874)
# Issue Add tool to reset js/parse_tests data gets out of date easily. Manually updating it sucks. # Resolution Publish a script that copies the "actual" data to the "want" data. DO NOT CHECK IN THE RESULTS WITHOUT CAREFUL REVIEW.
1 parent 4d77744 commit efa2e1e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

bin/fix_js_parse_tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
# fix_js_parse_tests.sh -- Fix up the pkg/js/parse_tests "want" files.
4+
#
5+
# DO NOT use this without carefully checking the output. You could
6+
# accidentally codify bad test data and commit it to the repo.
7+
#
8+
# Useful bash/zsh alias:
9+
# alias fixjsparse='"$(git rev-parse --show-toplevel)/bin/fix_js_parse_tests.sh"'
10+
11+
set -e
12+
13+
cd $(git rev-parse --show-toplevel)
14+
cd pkg/js
15+
find . -type f -name \*.ACTUAL -print -delete
16+
go test -count=1 ./... || true
17+
cd parse_tests
18+
fmtjson *.json *.json.ACTUAL
19+
for i in *.ACTUAL ; do f=$(basename $i .ACTUAL) ; mv $i $f ; done

0 commit comments

Comments
 (0)