Skip to content

Commit 1a10561

Browse files
committed
Throw more tests
1 parent e7a4127 commit 1a10561

File tree

7 files changed

+61
-14
lines changed

7 files changed

+61
-14
lines changed

analysis/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ tests/node_modules/.bin/rescript:
3737

3838
test: dce tests/node_modules/.bin/rescript
3939
@cd tests && node_modules/.bin/rescript
40+
OCAMLOPT -o testmore.exe ./testmore.ml
41+
OCAMLOPT -o testfile.exe ./testfile.ml
42+
OCAMLOPT -o testfile2.exe ./testfile2.ml
4043
./test.sh
4144

4245
clean:

analysis/basetest.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hello
2+
world
3+
this is basetest

analysis/randomfile.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hello this is used
2+
by
3+
testfile

analysis/test.sh

+31-14
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,46 @@ function exp {
22
echo "$(dirname $1)/expected/$(basename $1).txt"
33
}
44

5-
echo "cat -A test.sh"
6-
cat -A tests/src/expected/Auto.res.txt
7-
echo "done---------"
8-
echo "git diff test.sh"
9-
git diff tests/src/expected/Auto.res.txt
10-
echo "done---------"
11-
125
for file in tests/src/*.{res,resi}; do
136
./rescript-editor-analysis.exe test $file &> $(exp $file)
147
done
158

9+
./testmore.exe > helloworld.txt
10+
./testfile.exe > helloworld2.txt
11+
./testfile2.exe > helloworld3.txt
12+
13+
echo "cat basetest.txt"
14+
cat -A basetest.txt
15+
echo "------"
16+
echo "cat basetest.txt > pipetest.txt then cat"
17+
cat basetest.txt > pipetest.txt
18+
cat -A pipetest.txt
19+
echo "------"
20+
echo "cat helloworld.txt"
21+
cat -A helloworld.txt
22+
echo "------"
23+
echo "cat helloworld2.txt"
24+
cat -A helloworld2.txt
25+
echo "------"
26+
echo "cat helloworld3.txt"
27+
cat -A helloworld3.txt
28+
echo "------"
29+
echo "dox2unix helloworld.txt"
30+
dos2unix helloworld.txt
31+
echo "------"
32+
echo "dox2unix helloworld2.txt"
33+
dos2unix helloworld2.txt
34+
echo "------"
35+
echo "dox2unix helloworld3.txt"
36+
dos2unix helloworld3.txt
37+
echo "------"
38+
echo "========all done!========="
39+
1640
# # CI
1741
# if [ "$RUNNER_OS" == "Windows" ]; then
1842
# dos2unix tests/src/expected/*
1943
# fi
2044

21-
echo "cat -A test.sh last"
22-
cat -A tests/src/expected/Auto.res.txt
23-
echo "done cat last---------"
24-
echo "git diff test.sh last"
25-
diff -u tests/src/expected/Auto.res.txt tests/src/expected/Auto.res.2.txt
26-
echo "done git last---------"
27-
2845
warningYellow='\033[0;33m'
2946
successGreen='\033[0;32m'
3047
reset='\033[0m'

analysis/testfile.ml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let readFile ~filename =
2+
try
3+
(* windows can't use open_in *)
4+
let chan = open_in_bin filename in
5+
let content = really_input_string chan (in_channel_length chan) in
6+
close_in_noerr chan;
7+
Some content
8+
with _ -> None
9+
10+
let content = readFile "./randomfile.txt"
11+
12+
let () = match content with
13+
| None -> raise Not_found
14+
| Some content -> print_endline content

analysis/testfile2.ml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let content = {|
2+
hello
3+
how are you
4+
|}
5+
6+
let () = print_endline content

analysis/testmore.ml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print_endline "hello, world!"

0 commit comments

Comments
 (0)