Skip to content

Also move syntax_tests under tests #7090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion compiler/syntax/testrunner/res_test.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module IO = Res_io

let data_dir = "compiler/syntax/tests"
let data_dir = "tests/syntax_tests"

(* test printing of .res file*)
let () =
Expand Down
7 changes: 0 additions & 7 deletions compiler/syntax/tests/api/mlSyntax.ml

This file was deleted.

6 changes: 0 additions & 6 deletions compiler/syntax/tests/api/mliSyntax.mli

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ shopt -s extglob

dune build @fmt --auto-promote

files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*")
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/*")
./cli/rescript format $files
2 changes: 1 addition & 1 deletion scripts/format_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case "$(uname -s)" in
fi

echo "Checking ReScript code formatting..."
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
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/*")
if ./cli/rescript format -check $files; then
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
else
Expand Down
14 changes: 7 additions & 7 deletions scripts/test_syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ function maybeWait {
[[ $((taskCount % 20)) = 0 ]] && wait
}

pushd compiler/syntax
pushd tests

rm -rf temp
mkdir temp

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

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

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

find tests/{idempotency,printer} -name "*.res" -o -name "*.resi" >temp/files.txt
find syntax_tests/{idempotency,printer} -name "*.res" -o -name "*.resi" >temp/files.txt
while read file; do {
mkdir -p temp/$(dirname $file)
sexpAst1=temp/$file.sexp
Expand Down
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/
temp/
Loading