Skip to content

Commit

Permalink
Update tests to use local zanuda executable. Related to #57
Browse files Browse the repository at this point in the history
Signed-off-by: Kakadu <[email protected]>
  • Loading branch information
Kakadu committed Jul 26, 2024
1 parent a725810 commit 0581284
Show file tree
Hide file tree
Showing 36 changed files with 67 additions and 42 deletions.
15 changes: 8 additions & 7 deletions tests/commandline.t
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
$ zanuda --help > /dev/null
$ which zanuda
$ untyped/zanuda.exe --help > /dev/null
Check untyped AST in file could be doable, but currently is almost dead.
Typed AST provide much more information
$ touch empty.ml
$ zanuda -I . -dump empty.ml -o /dev/null -del-prefix / -add-prefix / > /dev/null
$ untyped/zanuda.exe -I . -dump empty.ml -o /dev/null -del-prefix / -add-prefix / > /dev/null
Golint format currently is not used
$ zanuda -ogolint 1.golint > /dev/null
$ zanuda -dump-lints 1.json 2> /dev/null
$ zanuda -o file.out -v 2> /dev/null
$ untyped/zanuda.exe -ogolint 1.golint > /dev/null
$ untyped/zanuda.exe -dump-lints 1.json 2> /dev/null
$ untyped/zanuda.exe -o file.out -v 2> /dev/null
Testing config file
$ echo '-no-no-topelevel-eval\nasdf' > .zanuda
$ zanuda -o file.out -v 2> /dev/null
$ untyped/zanuda.exe -o file.out -v 2> /dev/null
$ rm -fr .zanuda

$ zanuda -dump > /dev/null
$ untyped/zanuda.exe -dump > /dev/null
4 changes: 4 additions & 0 deletions tests/dune
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
(cram
(applies_to :whole_subtree))

(cram
(applies_to commandline)
(deps untyped/zanuda.exe))
2 changes: 1 addition & 1 deletion tests/typed/Equality.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-match_bool -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-match_bool -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Equality.ml", line 1, characters 11-36:
1 | let __ x = if x = None then 1 else 1
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/Eta.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
^
Error (warning 27 [unused-var-strict]): unused variable x.
[1]
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Eta.ml", line 3, characters 12-23:
3 | let wrapper x = my_id x
^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/ExcTry.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "ExcTryWithWildcard.ml", lines 2-3, characters 2-11:
2 | ..try raise Not_found
3 | with _ -> 1
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/Ignore.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Ignore.ml", line 2, characters 2-29:
2 | ignore (List.map ((+)1) xs);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/License.t/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ dune build @default ./REPL.exe

$ zanuda -no-check-filesystem -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -dir . -ordjsonl /dev/null
module "Asdf__" is omitted
File "REPL.ml", line 1, characters 0-9:
1 | open List
Expand Down
3 changes: 2 additions & 1 deletion tests/typed/ListFusion.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "ListFusion.ml", line 1, characters 12-48:
1 | let __ xs = List.map Fun.id (List.map Fun.id xs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -24,3 +24,4 @@
as
'List.concat_map f xs'


2 changes: 1 addition & 1 deletion tests/typed/MatchBool.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-propose_function_untyped -no-top_file_license -no-propose_function -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-propose_function_untyped -no-top_file_license -no-propose_function -dir . -ordjsonl /dev/null
File "MatchBool.ml", lines 1-3, characters 20-14:
1 | ....................match a with
2 | | true -> 1
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/Mutually_rec_types.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Mutually_rec_types.ml", lines 3-9, characters 2-19:
3 | ..type t1 =
4 | | A of
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/Record1.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Record2.ml", line 6, characters 16-36:
6 | let t_of_t0 f = { e=f.e; g=f.g; h=1}
^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/StringConcat.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "StringConcat.ml", line 6, characters 8-26:
6 | let _ = List.fold_left (^)
^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/ToplevelEval.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -with-no_toplevel_eval -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -with-no_toplevel_eval -dir . -ordjsonl /dev/null
File "test_toplevel_eval.ml", line 1, characters 0-3:
1 | 1+1;;
^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/Tuple_matching.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -no-propose_function -no-propose_function_untyped -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -no-propose_function -no-propose_function_untyped -dir . -ordjsonl /dev/null
File "Tuple_matching.ml", lines 2-3, characters 2-18:
2 | ..match scru with
3 | | (_, _) -> true
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/amb_cstrs.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "amb_cstrs.ml", lines 2-4, characters 2-14:
2 | ..type 'a result =
3 | | Error of string
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/ast.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-top_file_license -dir . -ordjsonl /dev/null
File "Parsetree.mli", line 2, characters 2-16:
2 | | App of t * t
^^^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion tests/typed/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
(modules exec1))

(cram
(deps %{bin:zanuda}))
(deps ./zanuda.exe))

(rule
(deps %{project_root}/src/main.exe)
(target zanuda.exe)
(action
(copy %{deps} %{target})))
2 changes: 1 addition & 1 deletion tests/typed/failwith.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Failwith.ml", line 1, characters 12-20:
1 | let foo _ = failwith "not implemented"
^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/filesystem.t/run.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
$ dune build
$ zanuda -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-top_file_license -dir . -ordjsonl /dev/null
File '_build/default/No_iface.ml' doesn't have corresponding .mli interface
4 changes: 2 additions & 2 deletions tests/typed/format.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build 2>&1 #| sed 's/test_Format.ml\[[[:digit:]]\+,[[:digit:]]\++[[:digit:]]\+\]//g'
$ zanuda -no-top_file_license -dir . -ordjsonl /dev/null
$ dune build 2>&1 #| sed 's/test_Format.ml\[[[:digit:]]\+,[[:digit:]]\++[[:digit:]]\+\]//g'
$ ../zanuda.exe -no-top_file_license -dir . -ordjsonl /dev/null
File "test_Format.ml", line 1, characters 25-35:
1 | let _1 x = Format.printf "a\"%s\"b" x
^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/function.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -no-propose_function -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -no-propose_function -dir . -ordjsonl /dev/null
File "Function.ml", line 1, characters 23-56:
1 | let should_give_a_lint x = match x with [] -> 1 | _ -> 2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/hashtables.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Hashtables.ml", line 3, characters 22-23:
3 | if None = None then h else h
^
Expand Down
3 changes: 2 additions & 1 deletion tests/typed/ifbool.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "IfBool.ml", line 2, characters 2-23:
2 | if true then 1 else 2
^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -25,3 +25,4 @@
^^^^^^^^^^^^
Alert zanuda-linter: Conjunction with boolean smells bad


2 changes: 1 addition & 1 deletion tests/typed/list_len.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "list_len.ml", line 1, characters 12-30:
1 | let __ xs = List.length xs < 0
^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/monad_laws.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-eta_reduction -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-eta_reduction -no-top_file_license -dir . -ordjsonl /dev/null
File "laws.ml", line 5, characters 12-35:
5 | let foo x = x >>= fun y -> return y
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/typed/nested_if.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "Nested_if.ml", line 5, characters 2-77:
5 | if x then (if x then (if x then (if x then x else y) else y) else y) else y
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/untyped/ast_docs.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File '_build/default/.test_dollar.objs/byte/ast.cmti' doesn't exist. Maybe some of source files are not compiled?
File "ast.mli", lines 1-4, characters 0-17:
1 | type exprA =
Expand Down
2 changes: 1 addition & 1 deletion tests/untyped/dollar.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -dir . -ordjsonl /dev/null
File "dollar.ml", line 4, characters 2-21:
4 | pp @@ { field = 1 };;
^^^^^^^^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion tests/untyped/dune
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
(cram
(deps %{bin:zanuda}))
(deps ./zanuda.exe))

(rule
(deps %{project_root}/src/main.exe)
(target zanuda.exe)
(action
(copy %{deps} %{target})))
2 changes: 1 addition & 1 deletion tests/untyped/manual_fold.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-eta_reduction -no-top_file_license -no-propose_function_untyped -no-propose_function -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-eta_reduction -no-top_file_license -no-propose_function_untyped -no-propose_function -dir . -ordjsonl /dev/null
File "manual_fold.ml", lines 2-5, characters 0-39:
2 | let rec fold_left f acc l =
3 | match l with
Expand Down
2 changes: 1 addition & 1 deletion tests/untyped/manual_map.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-top_file_license -no-propose_function_untyped -no-propose_function -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-top_file_license -no-propose_function_untyped -no-propose_function -dir . -ordjsonl /dev/null
File "manual_map.ml", lines 2-4, characters 0-31:
2 | let rec map1 f = function
3 | | [] -> []
Expand Down
2 changes: 1 addition & 1 deletion tests/untyped/var_should_not_be_used.t/run.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dune build
$ zanuda -no-check-filesystem -no-eta_reduction -no-top_file_license -dir . -ordjsonl /dev/null
$ ../zanuda.exe -no-check-filesystem -no-eta_reduction -no-top_file_license -dir . -ordjsonl /dev/null
File "lib.ml", line 1, characters 8-12:
1 | let rec _foo x = _foo x
^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/unused_func/Inline_tests.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
$ dune test
$ dune describe

$ zanuda -unused-decls . |grep -v "Base\|Angstrom\|Ppx_deriving_runtime"
$ ../zanuda.exe -unused-decls . |grep -v "Base\|Angstrom\|Ppx_deriving_runtime"
Unused declarations:
0: Nonwrapped.nonwrapped_fac
2 changes: 1 addition & 1 deletion tests/unused_func/Only_mli.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$ dune describe
$ dune exec ./only_mli_demo.exe #-j1 --verbose
my_id 5 = 5
$ zanuda -unused-decls .
$ ../zanuda.exe -unused-decls .
module "Only_mli_lib" is omitted
Unused declarations:
0: A.incr
Expand Down
2 changes: 1 addition & 1 deletion tests/unused_func/Simple.t/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ dune build @check
$ dune describe
$ zanuda -unused-decls .
$ ../zanuda.exe -unused-decls .
module "Custom_lib" is omitted
Unused declarations:
0: Simple.Meow.meow
Expand Down
8 changes: 7 additions & 1 deletion tests/unused_func/dune
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
(cram
(deps %{bin:zanuda}))
(deps ./zanuda.exe))

(rule
(deps %{project_root}/src/main.exe)
(target zanuda.exe)
(action
(copy %{deps} %{target})))

0 comments on commit 0581284

Please sign in to comment.