From f245153310ad8d015d8f436c1f917cb6fba8d8af Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 24 May 2016 20:15:08 -0400 Subject: [PATCH] tests: update nitunit tests Signed-off-by: Jean Privat --- tests/sav/nitunit_args1.res | 46 ++++++++++++++++++++++++++++++++----------- tests/sav/nitunit_args4.res | 10 +++++++--- tests/sav/nitunit_args5.res | 10 +++++++--- tests/sav/nitunit_args6.res | 23 ++++++++++++++++------ tests/sav/nitunit_args7.res | 11 ++++++++--- tests/sav/nitunit_args8.res | 22 +++++++++++++++------ tests/sav/nitunit_args9.res | 43 +++++++++++++++++++++++++++------------- tests/test_nitunit.nit | 2 ++ 8 files changed, 121 insertions(+), 46 deletions(-) diff --git a/tests/sav/nitunit_args1.res b/tests/sav/nitunit_args1.res index 48642c1..cbfe0bc 100644 --- a/tests/sav/nitunit_args1.res +++ b/tests/sav/nitunit_args1.res @@ -1,19 +1,43 @@ -test_nitunit.nit:21,7--22,0: ERROR: test_nitunit$X (in .nitunit/test_nitunit-2.nit): -Runtime error: Assert failed (.nitunit/test_nitunit-2.nit:5) + * Docunits of module test_nitunit::test_nitunit [ ] 0/4 * Docunits of module test_nitunit::test_nitunit [ X] 1/4 test_nitunit$X$foo1 [KO] * Docunits of module test_nitunit::test_nitunit [. X] 2/4 test_nitunit::test_nitunit [OK] * Docunits of module test_nitunit::test_nitunit [.X X] 3/4 test_nitunit$X [KO] * Docunits of module test_nitunit::test_nitunit [.XXX] 4/4 test_nitunit$X$foo [KO] * Docunits of module test_nitunit::test_nitunit [.XXX] 4/4 +[OK] test_nitunit::test_nitunit +[KO] test_nitunit$X + test_nitunit.nit:21,7--22,0: Runtime error in .nitunit/test_nitunit-2.nit + # assert false + ^ + Output + Runtime error: Assert failed (.nitunit/test_nitunit-2.nit:5) -test_nitunit.nit:24,8--25,0: FAILURE: test_nitunit$X$foo (in .nitunit/test_nitunit-3.nit): -.nitunit/test_nitunit-3.nit:5,8--27: Error: method or variable `undefined_identifier` unknown in `Sys`. +[KO] test_nitunit$X$foo + test_nitunit.nit:24,8--25,0: Compilation error in .nitunit/test_nitunit-3.nit + # assert undefined_identifier + ^ + Output + .nitunit/test_nitunit-3.nit:5,8--27: Error: method or variable `undefined_identifier` unknown in `Sys`. -test_test_nitunit.nit:36,2--40,4: ERROR: test_foo1 (in file .nitunit/gen_test_test_nitunit.nit): Runtime error: Assert failed (test_test_nitunit.nit:39) +[KO] test_nitunit$X$foo1 + test_nitunit.nit:28,15: Syntax Error: unexpected operator '!'. + # assert !@#$%^&*() + ^ + * Test-suite of module test_test_nitunit::test_test_nitunit [ ] 0/3 * Test-suite of module test_test_nitunit::test_test_nitunit [. ] 1/3 test_test_nitunit$TestX$test_foo [OK] * Test-suite of module test_test_nitunit::test_test_nitunit [.X ] 2/3 test_test_nitunit$TestX$test_foo1 [KO] * Test-suite of module test_test_nitunit::test_test_nitunit [.X.] 3/3 test_test_nitunit$TestX$test_foo2 [OK] * Test-suite of module test_test_nitunit::test_test_nitunit [.X.] 3/3 +[OK] test_test_nitunit$TestX$test_foo +[KO] test_test_nitunit$TestX$test_foo1 + test_test_nitunit.nit:36,2--40,4: Runtime Error in file .nitunit/gen_test_test_nitunit.nit + # will fail + ^ + Output + Runtime error: Assert failed (test_test_nitunit.nit:39) +[OK] test_test_nitunit$TestX$test_foo2 DocUnits: -Entities: 27; Documented ones: 3; With nitunits: 3; Failures: 2 +Entities: 27; Documented ones: 4; With nitunits: 4; Failures: 3 TestSuites: Class suites: 1; Test Cases: 3; Failures: 1 -assert true -assert false -Compilation Error.nitunit/test_nitunit-3.nit:5,8--27: Error: method or variable `undefined_identifier` unknown in `Sys`. +assert true +Runtime error in .nitunit/test_nitunit-2.nitRuntime error: Assert failed (.nitunit/test_nitunit-2.nit:5) +assert false +Compilation error in .nitunit/test_nitunit-3.nit.nitunit/test_nitunit-3.nit:5,8--27: Error: method or variable `undefined_identifier` unknown in `Sys`. assert undefined_identifier -Runtime ErrorRuntime error: Assert failed (test_test_nitunit.nit:39) - \ No newline at end of file +Syntax Error: unexpected operator '!'.assert !@#$%^&*() +Runtime Error in file .nitunit/gen_test_test_nitunit.nitRuntime error: Assert failed (test_test_nitunit.nit:39) + \ No newline at end of file diff --git a/tests/sav/nitunit_args4.res b/tests/sav/nitunit_args4.res index 4cb3aaa..95b3751 100644 --- a/tests/sav/nitunit_args4.res +++ b/tests/sav/nitunit_args4.res @@ -1,3 +1,7 @@ + * Docunits of module test_nitunit2::test_nitunit2 [ ] 0/3 * Docunits of module test_nitunit2::test_nitunit2 [. ] 1/3 test_nitunit2::test_nitunit2$core::Sys$foo1 [OK] * Docunits of module test_nitunit2::test_nitunit2 [.. ] 2/3 test_nitunit2::test_nitunit2$core::Sys$bar2 [OK] * Docunits of module test_nitunit2::test_nitunit2 [...] 3/3 test_nitunit2::test_nitunit2$core::Sys$foo3 [OK] * Docunits of module test_nitunit2::test_nitunit2 [...] 3/3 +[OK] test_nitunit2::test_nitunit2$core::Sys$foo1 +[OK] test_nitunit2::test_nitunit2$core::Sys$bar2 +[OK] test_nitunit2::test_nitunit2$core::Sys$foo3 DocUnits: DocUnits Success Entities: 4; Documented ones: 3; With nitunits: 3; Failures: 0 @@ -5,17 +9,17 @@ Entities: 4; Documented ones: 3; With nitunits: 3; Failures: 0 TestSuites: No test cases found Class suites: 0; Test Cases: 0; Failures: 0 -if true then +if true then assert true end -if true then +if true then assert true end -var a = 1 +var a = 1 assert a == 1 assert a == 1 \ No newline at end of file diff --git a/tests/sav/nitunit_args5.res b/tests/sav/nitunit_args5.res index 8fa1c3c..f161044 100644 --- a/tests/sav/nitunit_args5.res +++ b/tests/sav/nitunit_args5.res @@ -1,3 +1,7 @@ + * Docunits of module test_doc2::test_doc2 [ ] 0/3 * Docunits of module test_doc2::test_doc2 [. ] 1/3 test_doc2::test_doc2$core::Sys$foo1 [OK] * Docunits of module test_doc2::test_doc2 [.. ] 2/3 test_doc2::test_doc2$core::Sys$foo2 [OK] * Docunits of module test_doc2::test_doc2 [...] 3/3 test_doc2::test_doc2$core::Sys$foo3 [OK] * Docunits of module test_doc2::test_doc2 [...] 3/3 +[OK] test_doc2::test_doc2$core::Sys$foo1 +[OK] test_doc2::test_doc2$core::Sys$foo2 +[OK] test_doc2::test_doc2$core::Sys$foo3 DocUnits: DocUnits Success Entities: 6; Documented ones: 5; With nitunits: 3; Failures: 0 @@ -5,7 +9,7 @@ Entities: 6; Documented ones: 5; With nitunits: 3; Failures: 0 TestSuites: No test cases found Class suites: 0; Test Cases: 0; Failures: 0 -assert true # tested -assert true # tested -assert true # tested +assert true # tested +assert true # tested +assert true # tested \ No newline at end of file diff --git a/tests/sav/nitunit_args6.res b/tests/sav/nitunit_args6.res index ca7ee6a..13ff875 100644 --- a/tests/sav/nitunit_args6.res +++ b/tests/sav/nitunit_args6.res @@ -1,16 +1,27 @@ -test_nitunit3/README.md:7,3--5: Syntax Error: unexpected malformed character '\]. To suppress this message, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). -test_nitunit3/README.md:4,2--15,0: ERROR: test_nitunit3> (in .nitunit/test_nitunit3-0.nit): Runtime error -Runtime error: Assert failed (.nitunit/test_nitunit3-0.nit:7) + * Docunits of group test_nitunit3> [ ] 0/2 * Docunits of group test_nitunit3> [ X] 1/2 test_nitunit3> [KO] * Docunits of group test_nitunit3> [XX] 2/2 test_nitunit3> [KO] * Docunits of group test_nitunit3> [XX] 2/2 +[KO] test_nitunit3> + test_nitunit3/README.md:4,2--15,0: Runtime error in .nitunit/test_nitunit3-0.nit with argument 1 + ~~ + ^ + Output + Runtime error: Assert failed (.nitunit/test_nitunit3-0.nit:7) +[KO] test_nitunit3> + test_nitunit3/README.md:7,3--5: Syntax Error: unexpected malformed character '\]. + ~~~ +; + ^ + * Docunits of module test_nitunit3::test_nitunit3 [ ] 0/1 * Docunits of module test_nitunit3::test_nitunit3 [.] 1/1 test_nitunit3::test_nitunit3 [OK] * Docunits of module test_nitunit3::test_nitunit3 [.] 1/1 +[OK] test_nitunit3::test_nitunit3 DocUnits: Entities: 2; Documented ones: 2; With nitunits: 3; Failures: 2 TestSuites: No test cases found Class suites: 0; Test Cases: 0; Failures: 0 -Compilation ErrorRuntime error: Assert failed (.nitunit/test_nitunit3-0.nit:7) +Runtime error in .nitunit/test_nitunit3-0.nit with argument 1Runtime error: Assert failed (.nitunit/test_nitunit3-0.nit:7) assert false assert true -Compilation Errortest_nitunit3/README.md:7,3--5: Syntax Error: unexpected malformed character '\].;'\][] -assert true +Syntax Error: unexpected malformed character '\].;'\][] +assert true \ No newline at end of file diff --git a/tests/sav/nitunit_args7.res b/tests/sav/nitunit_args7.res index 0888b04..bf0c504 100644 --- a/tests/sav/nitunit_args7.res +++ b/tests/sav/nitunit_args7.res @@ -1,5 +1,10 @@ -test_nitunit_md.md:4,2--16,0: ERROR: nitunit..test_nitunit_md.md:1,0--15,0 (in .nitunit/file-0.nit): Runtime error -Runtime error: Assert failed (.nitunit/file-0.nit:8) + * Docunits of file test_nitunit_md.md:1,0--15,0 [ ] 0/1 * Docunits of file test_nitunit_md.md:1,0--15,0 [X] 1/1 nitunit..test_nitunit_md.md:1,0--15,0 [KO] * Docunits of file test_nitunit_md.md:1,0--15,0 [X] 1/1 +[KO] nitunit..test_nitunit_md.md:1,0--15,0 + test_nitunit_md.md:4,2--16,0: Runtime error in .nitunit/file-0.nit with argument 1 + ~~ + ^ + Output + Runtime error: Assert failed (.nitunit/file-0.nit:8) DocUnits: Entities: 1; Documented ones: 1; With nitunits: 1; Failures: 1 @@ -7,7 +12,7 @@ Entities: 1; Documented ones: 1; With nitunits: 1; Failures: 1 TestSuites: No test cases found Class suites: 0; Test Cases: 0; Failures: 0 -Compilation ErrorRuntime error: Assert failed (.nitunit/file-0.nit:8) +Runtime error in .nitunit/file-0.nit with argument 1Runtime error: Assert failed (.nitunit/file-0.nit:8) var a = 1 assert 1 == 1 assert false diff --git a/tests/sav/nitunit_args8.res b/tests/sav/nitunit_args8.res index afa1ac3..c3e9bf7 100644 --- a/tests/sav/nitunit_args8.res +++ b/tests/sav/nitunit_args8.res @@ -1,13 +1,23 @@ -test_doc3.nit:17,9--15: Syntax Error: unexpected identifier 'garbage'. To suppress this message, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). -test_doc3.nit:23,4--10: Syntax Error: unexpected identifier 'garbage'. To suppress this message, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). -test_doc3.nit:30,4--10: Syntax Error: unexpected identifier 'garbage'. To suppress this message, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). + * Docunits of module test_doc3::test_doc3 [ ] 0/3 * Docunits of module test_doc3::test_doc3 [X ] 1/3 test_doc3::test_doc3$core::Sys$foo1 [KO] * Docunits of module test_doc3::test_doc3 [XX ] 2/3 test_doc3::test_doc3$core::Sys$foo2 [KO] * Docunits of module test_doc3::test_doc3 [XXX] 3/3 test_doc3::test_doc3$core::Sys$foo3 [KO] * Docunits of module test_doc3::test_doc3 [XXX] 3/3 +[KO] test_doc3::test_doc3$core::Sys$foo1 + test_doc3.nit:17,9--15: Syntax Error: unexpected identifier 'garbage'. + # *garbage* + ^ +[KO] test_doc3::test_doc3$core::Sys$foo2 + test_doc3.nit:23,4--10: Syntax Error: unexpected identifier 'garbage'. + # *garbage* + ^ +[KO] test_doc3::test_doc3$core::Sys$foo3 + test_doc3.nit:30,4--10: Syntax Error: unexpected identifier 'garbage'. + # *garbage* + ^ DocUnits: Entities: 6; Documented ones: 5; With nitunits: 3; Failures: 3 TestSuites: No test cases found Class suites: 0; Test Cases: 0; Failures: 0 -Compilation Errortest_doc3.nit:17,9--15: Syntax Error: unexpected identifier 'garbage'. *garbage* -Compilation Errortest_doc3.nit:23,4--10: Syntax Error: unexpected identifier 'garbage'.*garbage* -Compilation Errortest_doc3.nit:30,4--10: Syntax Error: unexpected identifier 'garbage'.*garbage* +Syntax Error: unexpected identifier 'garbage'. *garbage* +Syntax Error: unexpected identifier 'garbage'.*garbage* +Syntax Error: unexpected identifier 'garbage'.*garbage* \ No newline at end of file diff --git a/tests/sav/nitunit_args9.res b/tests/sav/nitunit_args9.res index 27d74a9..5806e40 100644 --- a/tests/sav/nitunit_args9.res +++ b/tests/sav/nitunit_args9.res @@ -1,16 +1,28 @@ -test_nitunit4/test_nitunit4.nit:22,2--26,4: ERROR: test_foo (in file .nitunit/gen_test_nitunit4.nit): Before Test -Tested method -After Test -Runtime error: Assert failed (test_nitunit4/test_nitunit4_base.nit:31) + * Test-suite of module test_nitunit4::test_nitunit4 [ ] 0/3 * Test-suite of module test_nitunit4::test_nitunit4 [X ] 1/3 test_nitunit4$TestTestSuite$test_foo [KO] * Test-suite of module test_nitunit4::test_nitunit4 [X. ] 2/3 test_nitunit4$TestTestSuite$test_bar [OK] * Test-suite of module test_nitunit4::test_nitunit4 [X.X] 3/3 test_nitunit4$TestTestSuite$test_baz [KO] * Test-suite of module test_nitunit4::test_nitunit4 [X.X] 3/3 +[KO] test_nitunit4$TestTestSuite$test_foo + test_nitunit4/test_nitunit4.nit:22,2--26,4: Runtime Error in file .nitunit/gen_test_nitunit4.nit + fun test_foo do + ^ + Output + Before Test + Tested method + After Test + Runtime error: Assert failed (test_nitunit4/test_nitunit4_base.nit:31) -test_nitunit4/test_nitunit4.nit:32,2--34,4: ERROR: test_baz (in file .nitunit/gen_test_nitunit4.nit): Diff ---- expected:test_nitunit4/test_nitunit4.sav/test_baz.res -+++ got:.nitunit/gen_test_nitunit4_test_baz.out1 -@@ -1 +1,3 @@ --Bad result file -+Before Test -+Tested method -+After Test +[OK] test_nitunit4$TestTestSuite$test_bar +[KO] test_nitunit4$TestTestSuite$test_baz + test_nitunit4/test_nitunit4.nit:32,2--34,4: Difference with expected output: diff -u test_nitunit4/test_nitunit4.sav/test_baz.res .nitunit/gen_test_nitunit4_test_baz.out1 + fun test_baz do + ^ + Output + Diff + --- expected:test_nitunit4/test_nitunit4.sav/test_baz.res + +++ got:.nitunit/gen_test_nitunit4_test_baz.out1 + @@ -1 +1,3 @@ + -Bad result file + +Before Test + +Tested method + +After Test DocUnits: No doc units found @@ -18,11 +30,14 @@ Entities: 12; Documented ones: 0; With nitunits: 0; Failures: 0 TestSuites: Class suites: 1; Test Cases: 3; Failures: 2 -Runtime ErrorBefore Test +Runtime Error in file .nitunit/gen_test_nitunit4.nitBefore Test Tested method After Test Runtime error: Assert failed (test_nitunit4/test_nitunit4_base.nit:31) -Runtime ErrorDiff +Before Test +Tested method +After Test +Difference with expected output: diff -u test_nitunit4/test_nitunit4.sav/test_baz.res .nitunit/gen_test_nitunit4_test_baz.out1Diff --- expected:test_nitunit4/test_nitunit4.sav/test_baz.res +++ got:.nitunit/gen_test_nitunit4_test_baz.out1 @@ -1 +1,3 @@ diff --git a/tests/test_nitunit.nit b/tests/test_nitunit.nit index b583197..d260cd1 100644 --- a/tests/test_nitunit.nit +++ b/tests/test_nitunit.nit @@ -24,6 +24,8 @@ class X # assert undefined_identifier fun foo do end + # a 'failure' unit test (does not parse) + # assert !@#$%^&*() fun foo1(a, b: Int) do end private fun foo2: Bool do return true -- 1.7.9.5