tests: Added augmented strings test
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 22 Mar 2016 16:03:18 +0000 (12:03 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Wed, 6 Apr 2016 15:33:51 +0000 (11:33 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

tests/sav/test_augmented.res [new file with mode: 0644]
tests/sav/test_augmented_alt1.res [new file with mode: 0644]
tests/test_augmented.nit [new file with mode: 0644]

diff --git a/tests/sav/test_augmented.res b/tests/sav/test_augmented.res
new file mode 100644 (file)
index 0000000..7a9a2cb
--- /dev/null
@@ -0,0 +1,38 @@
+s isa Bytes
+StringAB
+537472696E674142
+s2 isa FlatString
+Stringš“
+s3 isa Bytes
+StringAļæ½
+537472696E6741FD
+s4 isa Regex
+/String/
+true
+true
+false
+s5 isa FlatString
+Stringļæ½
+s6 isa FlatString
+\nStr\x00
+s7 isa FlatString
+\nString66515\x41
+s8 isa FlatString
+
+String66515A
+s9 isa Regex
+/
+0x47String/
+true
+false
+true
+s10 isa Regex
+/String/
+false
+false
+false
+s11 isa Regex
+/String/
+false
+true
+true
diff --git a/tests/sav/test_augmented_alt1.res b/tests/sav/test_augmented_alt1.res
new file mode 100644 (file)
index 0000000..f9f9450
--- /dev/null
@@ -0,0 +1 @@
+alt/test_augmented_alt1.nit:22,6--18: Error: cannot produce a ByteString on a Superstring
diff --git a/tests/test_augmented.nit b/tests/test_augmented.nit
new file mode 100644 (file)
index 0000000..a1b5400
--- /dev/null
@@ -0,0 +1,66 @@
+# 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.
+
+var c1 = b'G'
+var c2 = u'š“'
+
+var s = b"String\x41\x42"
+var s2 = "String\u0103D3"
+var s3 = b"String\x41\xFD"
+var s4 = re"String"i
+#alt1 s4 = b"String{c1}"
+var s5 = "String\xFD"
+var s6 = raw"\nStr\x00"
+var s7 = raw"\nString{c2}\x41"
+var s8 = "\nString{c2}\x41"
+var s9 = re"\n{c1}String"imb
+var s10 = re"String"b
+var s11 = re"String"m
+
+print "s isa {s.class_name}"
+print s
+print s.hexdigest
+print "s2 isa {s2.class_name}"
+print s2
+print "s3 isa {s3.class_name}"
+print s3
+print s3.hexdigest
+print "s4 isa {s4.class_name}"
+print s4
+print s4.ignore_case
+print s4.extended
+print s4.newline
+print "s5 isa {s5.class_name}"
+print s5
+print "s6 isa {s6.class_name}"
+print s6
+print "s7 isa {s7.class_name}"
+print s7
+print "s8 isa {s8.class_name}"
+print s8
+print "s9 isa {s9.class_name}"
+print s9
+print s9.ignore_case
+print s9.extended
+print s9.newline
+print "s10 isa {s10.class_name}"
+print s10
+print s10.ignore_case
+print s10.extended
+print s10.newline
+print "s11 isa {s11.class_name}"
+print s11
+print s11.ignore_case
+print s11.extended
+print s11.newline