summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Bovensiepen <[email protected]>2012-05-29 01:33:17 +0800
committerDaniel Bovensiepen <[email protected]>2012-05-29 01:33:17 +0800
commitb19575e5ac1e15c83797a0d8974bc4cc02b83fe6 (patch)
treeb0e0ecd589ae7bb58ac4805bf3c4e802fff85a5e
parent31e9705022d585d818a5c869f0f91e4d6b7c252e (diff)
downloadmruby-b19575e5ac1e15c83797a0d8974bc4cc02b83fe6.tar.gz
mruby-b19575e5ac1e15c83797a0d8974bc4cc02b83fe6.zip
Forgot Literals file
-rw-r--r--test/t/literals.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/t/literals.rb b/test/t/literals.rb
new file mode 100644
index 000000000..92f9bd755
--- /dev/null
+++ b/test/t/literals.rb
@@ -0,0 +1,49 @@
+##
+# Literals ISO Test
+
+assert('Literals Numerical', '8.7.6.2') do
+ # signed and unsigned integer
+ 1 == 1 and -1 == -1 and +1 == +1 and
+ # signed and unsigned float
+ 1.0 == 1.0 and -1.0 == -1.0 and
+ # binary
+ 0b10000000 == 128 and 0B10000000 == 128
+ # octal
+ 0o10 == 8 and 0O10 == 8 and 0_10 == 8
+ # hex
+ 0xff == 255 and 0Xff == 255 and
+ # decimal
+ 0d999 == 999 and 0D999 == 999 and
+ # decimal seperator
+ 10_000_000 == 10000000 and 1_0 == 10 and
+ # integer with exponent
+ 1e1 == 10.0 and 1e-1 == 0.1 and 1e+1 == 10.0
+ # float with exponent
+ 1.0e1 == 10.0 and 1.0e-1 == 0.1 and 1.0e+1 == 10.0
+end
+
+#assert('Literals Strings Single Quoted', '8.7.6.3.2') do
+# creates segmentation fault for now
+# 'abc' == 'abc' and '\'' == '\'' and '\\' == '\\'
+#end
+
+assert('Literals Strings Double Quoted', '8.7.6.3.3') do
+ a = "abc"
+
+ "abc" == "abc" and "\"" == "\"" and "\\" == "\\" and
+ "#{a}" == "abc"
+end
+
+#creates segmentation fault for now
+#assert('Literals Strings Quoted Non-Expanded', '8.7.6.3.4') do
+# a = %q{abc}
+# b = %q(abc)
+# c = %q[abc]
+# d = %q<abc>
+# e = %/abc/
+# f = %/ab\/c/
+
+# a == 'abc' and b == 'abc' and c == 'abc' and d == 'abc' and
+# e == 'abc' and f 'ab/c'
+#end
+