tests: test bad code in nitunits
authorJean Privat <jean@pryen.org>
Wed, 17 Jun 2015 15:15:05 +0000 (11:15 -0400)
committerJean Privat <jean@pryen.org>
Wed, 17 Jun 2015 15:15:05 +0000 (11:15 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/nitunit.args
tests/sav/nitunit_args6.res
tests/sav/nitunit_args8.res [new file with mode: 0644]
tests/test_doc3.nit [new file with mode: 0644]

index b3ac901..2d7d624 100644 (file)
@@ -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
index cef4d20..ac5aebd 100644 (file)
@@ -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.<group> (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 (file)
index 0000000..e1dcdb7
--- /dev/null
@@ -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
+<testsuites><testsuite package="test_doc3"><testcase classname="nitunit.test_doc3.standard::Sys" name="test_doc3::Sys::foo1"><failure message="test_doc3.nit:15,1--18,0: Invalid block of code. At 1,3--9: Syntax Error: unexpected identifier &#39;garbage&#39;.."></failure></testcase><testcase classname="nitunit.test_doc3.standard::Sys" name="test_doc3::Sys::foo2"><failure message="test_doc3.nit:20,1--25,0: Invalid block of code. At 1,2--8: Syntax Error: unexpected identifier &#39;garbage&#39;.."></failure></testcase><testcase classname="nitunit.test_doc3.standard::Sys" name="test_doc3::Sys::foo3"><failure message="test_doc3.nit:27,1--32,0: Invalid block of code. At 1,2--8: Syntax Error: unexpected identifier &#39;garbage&#39;.."></failure></testcase></testsuite><testsuite></testsuite></testsuites>
\ No newline at end of file
diff --git a/tests/test_doc3.nit b/tests/test_doc3.nit
new file mode 100644 (file)
index 0000000..41b7d67
--- /dev/null
@@ -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