From 7b295ec2aa91020bc83197b5927295b1868253a6 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 17 Jun 2015 11:15:05 -0400 Subject: [PATCH] tests: test bad code in nitunits Signed-off-by: Jean Privat --- tests/nitunit.args | 1 + tests/sav/nitunit_args6.res | 2 +- tests/sav/nitunit_args8.res | 10 ++++++++++ tests/test_doc3.nit | 46 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/sav/nitunit_args8.res create mode 100644 tests/test_doc3.nit diff --git a/tests/nitunit.args b/tests/nitunit.args index b3ac901..2d7d624 100644 --- a/tests/nitunit.args +++ b/tests/nitunit.args @@ -5,3 +5,4 @@ test_nitunit2.nit -o $WRITE test_doc2.nit --no-color -o $WRITE test_nitunit3 --no-color -o $WRITE test_nitunit_md.md --no-color -o $WRITE +test_doc3.nit --no-color -o $WRITE diff --git a/tests/sav/nitunit_args6.res b/tests/sav/nitunit_args6.res index cef4d20..ac5aebd 100644 --- a/tests/sav/nitunit_args6.res +++ b/tests/sav/nitunit_args6.res @@ -2,7 +2,7 @@ test_nitunit3/README.md: Error: there is a block of invalid Nit code, thus not c test_nitunit3/README.md: ERROR: nitunit.test_nitunit3. (in .nitunit/test_nitunit3-0.nit): Runtime error: Assert failed (.nitunit/test_nitunit3-0.nit:7) DocUnits: -Entities: 2; Documented ones: 2; With nitunits: 2; Failures: 2 +Entities: 2; Documented ones: 2; With nitunits: 3; Failures: 2 TestSuites: No test cases found diff --git a/tests/sav/nitunit_args8.res b/tests/sav/nitunit_args8.res new file mode 100644 index 0000000..e1dcdb7 --- /dev/null +++ b/tests/sav/nitunit_args8.res @@ -0,0 +1,10 @@ +test_doc3.nit:15,1--18,0: Error: there is a block of invalid Nit code, thus not considered a nitunit. To suppress this warning, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). At 1,3--9: Syntax Error: unexpected identifier 'garbage'.. +test_doc3.nit:20,1--25,0: Error: there is a block of invalid Nit code, thus not considered a nitunit. To suppress this warning, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). At 1,2--8: Syntax Error: unexpected identifier 'garbage'.. +test_doc3.nit:27,1--32,0: Error: there is a block of invalid Nit code, thus not considered a nitunit. To suppress this warning, enclose the block with a fence tagged `nitish` or `raw` (see `man nitdoc`). At 1,2--8: Syntax Error: unexpected identifier '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 + \ No newline at end of file diff --git a/tests/test_doc3.nit b/tests/test_doc3.nit new file mode 100644 index 0000000..41b7d67 --- /dev/null +++ b/tests/test_doc3.nit @@ -0,0 +1,46 @@ +# 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. + +# Test code +# +# *garbage* +fun foo1 do end + +# Test code +# +# ~~~ +# *garbage* +# ~~~ +fun foo2 do end + +# Test code +# +# ~~~nit +# *garbage* +# ~~~ +fun foo3 do end + +# Test code +# +# ~~~raw +# *garbage* +# ~~~ +fun foo4 do end + +# Test code +# +# ~~~nitish +# *garbage* +# ~~~ +fun foo5 do end -- 1.7.9.5