From 86cb4f34c5356d310bdbf2c52b5098dbc3852224 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 17 Nov 2014 10:45:42 -0500 Subject: [PATCH] tests: update and improve tests for nitunit Signed-off-by: Jean Privat --- tests/nitunit.args | 1 + tests/sav/nitunit_args1.res | 8 ++++---- tests/sav/nitunit_args4.res | 21 +++++++++++++++++++++ tests/test_nitunit2.nit | 43 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 tests/sav/nitunit_args4.res create mode 100644 tests/test_nitunit2.nit diff --git a/tests/nitunit.args b/tests/nitunit.args index cc7239d..70d5027 100644 --- a/tests/nitunit.args +++ b/tests/nitunit.args @@ -1,3 +1,4 @@ test_nitunit.nit --no-color -o $WRITE test_nitunit.nit --gen-suite --only-show test_nitunit.nit --gen-suite --only-show --private +test_nitunit2.nit -o $WRITE diff --git a/tests/sav/nitunit_args1.res b/tests/sav/nitunit_args1.res index 3a07d20..12b7181 100644 --- a/tests/sav/nitunit_args1.res +++ b/tests/sav/nitunit_args1.res @@ -1,6 +1,6 @@ -test_nitunit.nit:20,1--22,0: ERROR: nitunit.test_nitunit.test_nitunit::X. (in .nitunit/test_nitunit2.nit): Runtime error: Assert failed (.nitunit/test_nitunit2.nit:5) +test_nitunit.nit:20,1--22,0: ERROR: nitunit.test_nitunit.test_nitunit::X. (in .nitunit/test_nitunit-2.nit): Runtime error: Assert failed (.nitunit/test_nitunit-2.nit:5) -test_nitunit.nit:23,2--25,0: FAILURE: nitunit.test_nitunit.test_nitunit::X.test_nitunit::X::foo (in .nitunit/test_nitunit3.nit): .nitunit/test_nitunit3.nit:5,8--27: Error: Method or variable 'undefined_identifier' unknown in Sys. +test_nitunit.nit:23,2--25,0: FAILURE: nitunit.test_nitunit.test_nitunit::X.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. test_test_nitunit.nit:36,2--40,4: ERROR: test_foo1 (in file .nitunit/test_test_nitunit_TestX_test_foo1.nit): Runtime error: Assert failed (test_test_nitunit.nit:39) @@ -11,8 +11,8 @@ TestSuites: Class suites: 1; Test Cases: 3; Failures: 1 assert true assert false -assert undefined_identifier -outoutout \ No newline at end of file diff --git a/tests/sav/nitunit_args4.res b/tests/sav/nitunit_args4.res new file mode 100644 index 0000000..faaa0c9 --- /dev/null +++ b/tests/sav/nitunit_args4.res @@ -0,0 +1,21 @@ +DocUnits: +DocUnits Success +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 + + assert true + +end +if true then + + assert true + +end +var a = 1 +assert a == 1 +assert a == 1 + \ No newline at end of file diff --git a/tests/test_nitunit2.nit b/tests/test_nitunit2.nit new file mode 100644 index 0000000..899ff94 --- /dev/null +++ b/tests/test_nitunit2.nit @@ -0,0 +1,43 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# a fence unit +# +# ~~~~ +# if true then +# +# assert true +# +# end +# ~~~~ +fun foo1 do end + +# a block unit +# +# if true then +# +# assert true +# +# end +fun bar2 do end + +# a context continuation +# +# var a = 1 +# assert a == 1 +# +# bla bla +# +# assert a == 1 +fun foo3 do end -- 1.7.9.5