Skip to content

Commit 5f5917e

Browse files
authored
Also move syntax testrunner and benchmarks to the tests folder (#7097)
* compiler/syntax/benchmarks -> tests/syntax_benchmarks * tests/syntax_tests/* -> tests/syntax_tests/data/* * compiler/syntax/testrunner -> tests/syntax_tests * Fix reanalyze * Fix docs * CHANGELOG
1 parent b82fbce commit 5f5917e

File tree

1,791 files changed

+220
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,791 files changed

+220
-220
lines changed

CHANGELOG.md

+1

CONTRIBUTING.md

+1-1

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test-gentype:
4848
test-all: test test-gentype
4949

5050
reanalyze:
51-
reanalyze.exe -set-exit-code -all-cmt _build/default/compiler -suppress compiler/syntax/testrunner -exclude-paths compiler/outcome_printer,compiler/ounit_tests,compiler/ml,compiler/js_parser,compiler/frontend,compiler/ext,compiler/depends,compiler/core,compiler/common,compiler/cmij,compiler/bsb_helper,compiler/bsb
51+
reanalyze.exe -set-exit-code -all-cmt _build/default/compiler _build/default/tests -exclude-paths compiler/outcome_printer,compiler/ml,compiler/js_parser,compiler/frontend,compiler/ext,compiler/depends,compiler/core,compiler/common,compiler/cmij,compiler/bsb_helper,compiler/bsb
5252

5353
lib: build node_modules/.bin/semver
5454
./scripts/buildRuntime.sh

compiler/syntax/dune

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(dirs compiler-libs-406 src cli benchmarks testrunner)
1+
(dirs compiler-libs-406 src cli)
22

33
(env
44
(dev

compiler/syntax/src/res_io.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ let write_file ~filename ~contents:txt =
1111
let chan = open_out_bin filename in
1212
output_string chan txt;
1313
close_out chan
14-
[@@raises Sys_error]
14+
[@@raises Sys_error] [@@dead "+write_file"]

compiler/syntax/src/res_io.mli

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ val read_file : filename:string -> string
55

66
(* writes "content" into file with name "filename" *)
77
val write_file : filename:string -> contents:string -> unit
8+
[@@dead "+write_file"]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
(* Interface to print source code to res.
22
* Takes a filename called "input" and returns the corresponding formatted res syntax *)
3-
val print : ?ignore_parse_errors:bool -> string -> string
3+
val print : ?ignore_parse_errors:bool -> string -> string [@@dead "+print"]

scripts/format.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ shopt -s extglob
44

55
dune build @fmt --auto-promote
66

7-
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/syntax_tests/*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
7+
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/syntax_*/*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
88
./cli/rescript format $files

scripts/format_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ case "$(uname -s)" in
1717
fi
1818

1919
echo "Checking ReScript code formatting..."
20-
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/syntax_tests/*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
20+
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/syntax_*/*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
2121
if ./cli/rescript format -check $files; then
2222
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
2323
else

scripts/test_syntax.sh

+6-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ scriptDir=`dirname $0`
1010
# so let's use this workaround instead.
1111
DUNE_BIN_DIR=`cd "$scriptDir/../_build/install/default/bin"; pwd -P`
1212

13-
$DUNE_BIN_DIR/syntax_tests
14-
1513
function exp {
1614
echo "$(dirname $1)/expected/$(basename $1).txt"
1715
}
@@ -29,23 +27,23 @@ rm -rf temp
2927
mkdir temp
3028

3129
# parsing
32-
find syntax_tests/parsing/{errors,infiniteLoops,recovery} -name "*.res" -o -name "*.resi" >temp/files.txt
30+
find syntax_tests/data/parsing/{errors,infiniteLoops,recovery} -name "*.res" -o -name "*.resi" >temp/files.txt
3331
while read file; do
3432
$DUNE_BIN_DIR/res_parser -recover -print ml $file &> $(exp $file) & maybeWait
3533
done <temp/files.txt
36-
find syntax_tests/parsing/{grammar,other} -name "*.res" -o -name "*.resi" >temp/files.txt
34+
find syntax_tests/data/parsing/{grammar,other} -name "*.res" -o -name "*.resi" >temp/files.txt
3735
while read file; do
3836
$DUNE_BIN_DIR/res_parser -print ml $file &> $(exp $file) & maybeWait
3937
done <temp/files.txt
4038

4139
# printing
42-
find syntax_tests/{printer,conversion} -name "*.res" -o -name "*.resi" -o -name "*.ml" -o -name "*.mli" >temp/files.txt
40+
find syntax_tests/data/{printer,conversion} -name "*.res" -o -name "*.resi" -o -name "*.ml" -o -name "*.mli" >temp/files.txt
4341
while read file; do
4442
$DUNE_BIN_DIR/res_parser $file &> $(exp $file) & maybeWait
4543
done <temp/files.txt
4644

4745
# printing with ppx
48-
find syntax_tests/ppx/react -name "*.res" -o -name "*.resi" >temp/files.txt
46+
find syntax_tests/data/ppx/react -name "*.res" -o -name "*.resi" >temp/files.txt
4947
while read file; do
5048
$DUNE_BIN_DIR/res_parser -jsx-version 4 -jsx-mode "automatic" $file &> $(exp $file) & maybeWait
5149
done <temp/files.txt
@@ -61,7 +59,7 @@ diff=$(cat temp/diff.txt)
6159
if [[ $diff = "" ]]; then
6260
printf "${successGreen}✅ No unstaged tests difference.${reset}\n"
6361
else
64-
printf "${warningYellow}⚠️ There are unstaged differences in syntax_tests/! Did you break a test?\n${diff}\n${reset}"
62+
printf "${warningYellow}⚠️ There are unstaged differences in syntax_tests/data/! Did you break a test?\n${diff}\n${reset}"
6563
rm -r temp/
6664
exit 1
6765
fi
@@ -72,7 +70,7 @@ if [[ $ROUNDTRIP_TEST = 1 ]]; then
7270
roundtripTestsResult="temp/result.txt"
7371
touch $roundtripTestsResult
7472

75-
find syntax_tests/{idempotency,printer} -name "*.res" -o -name "*.resi" >temp/files.txt
73+
find syntax_tests/data/{idempotency,printer} -name "*.res" -o -name "*.resi" >temp/files.txt
7674
while read file; do {
7775
mkdir -p temp/$(dirname $file)
7876
sexpAst1=temp/$file.sexp

tests/dune

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(dirs ounit_tests)
1+
(dirs ounit_tests syntax_benchmarks syntax_tests)

compiler/syntax/benchmarks/Benchmark.ml renamed to tests/syntax_benchmarks/Benchmark.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ end = struct
226226
Benchmark.report b
227227

228228
let run () =
229-
let data_dir = "compiler/syntax/benchmarks/data" in
229+
let data_dir = "tests/syntax_benchmarks/data" in
230230
benchmark (Filename.concat data_dir "RedBlackTree.res") Rescript Parse;
231231
benchmark (Filename.concat data_dir "RedBlackTree.res") Rescript Print;
232232
benchmark
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)