Skip to content

Commit 7217302

Browse files
authored
Also move syntax_tests under tests (#7090)
* Remove ml syntax tests * compiler/syntax/tests -> tests/syntax_tests * Adapt scripts * Always run the syntax tests
1 parent 574d4ac commit 7217302

File tree

1,778 files changed

+215
-239
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,778 files changed

+215
-239
lines changed

.github/workflows/ci.yml

+2-14
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ jobs:
130130
131131
- name: Checkout
132132
uses: actions/checkout@v4
133-
with:
134-
fetch-depth: 2 # to be able to check for changes in subfolder compiler/syntax later
135133

136134
- name: Use Node.js
137135
uses: actions/setup-node@v4
@@ -297,22 +295,12 @@ jobs:
297295
if: steps.ninja-build-cache.outputs.cache-hit != 'true'
298296
run: node ./scripts/copyExes.js -ninja
299297

300-
- name: "Check if syntax subfolder has changed"
301-
id: syntax-diff
302-
shell: bash
303-
run: |
304-
if git diff --name-only --exit-code HEAD^ HEAD -- compiler/syntax; then
305-
echo "syntax_status=unchanged" >> $GITHUB_ENV
306-
else
307-
echo "syntax_status=changed" >> $GITHUB_ENV
308-
fi
309-
310298
- name: "Syntax: Run roundtrip tests"
311-
if: ${{ env.syntax_status == 'changed' && runner.os != 'Windows' }}
299+
if: ${{ runner.os != 'Windows' }}
312300
run: opam exec -- make test-syntax-roundtrip
313301

314302
- name: "Syntax: Run tests (Windows)"
315-
if: ${{ env.syntax_status == 'changed' && runner.os == 'Windows' }}
303+
if: ${{ runner.os == 'Windows' }}
316304
run: opam exec -- make test-syntax
317305

318306
- name: Build runtime/stdlib

compiler/syntax/testrunner/res_test.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module IO = Res_io
22

3-
let data_dir = "compiler/syntax/tests"
3+
let data_dir = "tests/syntax_tests"
44

55
(* test printing of .res file*)
66
let () =

compiler/syntax/tests/api/mlSyntax.ml

-7
This file was deleted.

compiler/syntax/tests/api/mliSyntax.mli

-6
This file was deleted.

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*")
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/*")
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/gentype_tests/typescript-react-example/node_modules/*")
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/*")
2121
if ./cli/rescript format -check $files; then
2222
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
2323
else

scripts/test_syntax.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ function maybeWait {
2323
[[ $((taskCount % 20)) = 0 ]] && wait
2424
}
2525

26-
pushd compiler/syntax
26+
pushd tests
2727

2828
rm -rf temp
2929
mkdir temp
3030

3131
# parsing
32-
find tests/parsing/{errors,infiniteLoops,recovery} -name "*.res" -o -name "*.resi" >temp/files.txt
32+
find syntax_tests/parsing/{errors,infiniteLoops,recovery} -name "*.res" -o -name "*.resi" >temp/files.txt
3333
while read file; do
3434
$DUNE_BIN_DIR/res_parser -recover -print ml $file &> $(exp $file) & maybeWait
3535
done <temp/files.txt
36-
find tests/parsing/{grammar,other} -name "*.res" -o -name "*.resi" >temp/files.txt
36+
find syntax_tests/parsing/{grammar,other} -name "*.res" -o -name "*.resi" >temp/files.txt
3737
while read file; do
3838
$DUNE_BIN_DIR/res_parser -print ml $file &> $(exp $file) & maybeWait
3939
done <temp/files.txt
4040

4141
# printing
42-
find tests/{printer,conversion} -name "*.res" -o -name "*.resi" -o -name "*.ml" -o -name "*.mli" >temp/files.txt
42+
find syntax_tests/{printer,conversion} -name "*.res" -o -name "*.resi" -o -name "*.ml" -o -name "*.mli" >temp/files.txt
4343
while read file; do
4444
$DUNE_BIN_DIR/res_parser $file &> $(exp $file) & maybeWait
4545
done <temp/files.txt
4646

4747
# printing with ppx
48-
find tests/ppx/react -name "*.res" -o -name "*.resi" >temp/files.txt
48+
find syntax_tests/ppx/react -name "*.res" -o -name "*.resi" >temp/files.txt
4949
while read file; do
5050
$DUNE_BIN_DIR/res_parser -jsx-version 4 -jsx-mode "automatic" $file &> $(exp $file) & maybeWait
5151
done <temp/files.txt
@@ -61,7 +61,7 @@ diff=$(cat temp/diff.txt)
6161
if [[ $diff = "" ]]; then
6262
printf "${successGreen}✅ No unstaged tests difference.${reset}\n"
6363
else
64-
printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}"
64+
printf "${warningYellow}⚠️ There are unstaged differences in syntax_tests/! Did you break a test?\n${diff}\n${reset}"
6565
rm -r temp/
6666
exit 1
6767
fi
@@ -72,7 +72,7 @@ if [[ $ROUNDTRIP_TEST = 1 ]]; then
7272
roundtripTestsResult="temp/result.txt"
7373
touch $roundtripTestsResult
7474

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

tests/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
lib/
2+
temp/

0 commit comments

Comments
 (0)