summaryrefslogtreecommitdiffhomepage
path: root/test/t
diff options
context:
space:
mode:
Diffstat (limited to 'test/t')
-rw-r--r--test/t/float.rb22
-rw-r--r--test/t/integer.rb10
-rw-r--r--test/t/string.rb8
-rw-r--r--test/t/syntax.rb4
4 files changed, 32 insertions, 12 deletions
diff --git a/test/t/float.rb b/test/t/float.rb
index d45709173..0aab0b1f2 100644
--- a/test/t/float.rb
+++ b/test/t/float.rb
@@ -178,3 +178,25 @@ assert('Float#nan?') do
assert_false (1.0/0.0).nan?
assert_false (-1.0/0.0).nan?
end
+
+assert('Float#<<') do
+ # Left Shift by one
+ assert_equal 46, 23.0 << 1
+
+ # Left Shift by a negative is Right Shift
+ assert_equal 23, 46.0 << -1
+end
+
+assert('Float#>>') do
+ # Right Shift by one
+ assert_equal 23, 46.0 >> 1
+
+ # Right Shift by a negative is Left Shift
+ assert_equal 46, 23.0 >> -1
+
+ # Don't raise on large Right Shift
+ assert_equal 0, 23.0 >> 128
+
+ # Don't raise on large Right Shift
+ assert_equal -1, -23.0 >> 128
+end
diff --git a/test/t/integer.rb b/test/t/integer.rb
index 6b8cc308d..be3c13db2 100644
--- a/test/t/integer.rb
+++ b/test/t/integer.rb
@@ -147,11 +147,6 @@ assert('Integer#<<', '15.2.8.3.12') do
# Left Shift by a negative is Right Shift
assert_equal 23, 46 << -1
-
- # Raise when shift is too large
- assert_raise(RangeError) do
- 2 << 128
- end
end
assert('Integer#>>', '15.2.8.3.13') do
@@ -165,11 +160,6 @@ assert('Integer#>>', '15.2.8.3.13') do
# Don't raise on large Right Shift
assert_equal 0, 23 >> 128
-
- # Raise when shift is too large
- assert_raise(RangeError) do
- 2 >> -128
- end
end
assert('Integer#ceil', '15.2.8.3.14') do
diff --git a/test/t/string.rb b/test/t/string.rb
index ee6fe0848..7326adce9 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -542,3 +542,11 @@ assert('String#each_byte') do
assert_equal bytes1, bytes2
end
+
+assert('String#freeze') do
+ str = "hello"
+ str.freeze
+
+ assert_raise(RuntimeError) { str.upcase! }
+end
+
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index dc1a4a3b9..fb6ffe408 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -1,6 +1,6 @@
assert('__FILE__') do
- file = __FILE__
- assert_true 'test/t/syntax.rb' == file || 'test\t\syntax.rb' == file
+ file = __FILE__.split('test/')[1]
+ assert_true 't/syntax.rb' == file || 't\syntax.rb' == file
end
assert('__LINE__') do