summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mrbtest.rake6
-rw-r--r--test/t/nomethoderror.rb13
-rw-r--r--test/t/string.rb7
3 files changed, 23 insertions, 3 deletions
diff --git a/test/mrbtest.rake b/test/mrbtest.rake
index e8eb6addd..c28cf3577 100644
--- a/test/mrbtest.rake
+++ b/test/mrbtest.rake
@@ -31,15 +31,15 @@ MRuby.each_target do
end
file ass_lib => ass_c
- file ass_c => "#{current_dir}/assert.rb" do |t|
+ file ass_c => ["#{current_dir}/assert.rb", __FILE__] do |t|
FileUtils.mkdir_p File.dirname t.name
open(t.name, 'w') do |f|
- mrbc.run f, [t.prerequisites], 'mrbtest_assert_irep'
+ mrbc.run f, [t.prerequisites.first], 'mrbtest_assert_irep'
end
end
file mlib => clib
- file clib => [mrbcfile, init] + mrbs do |t|
+ file clib => [mrbcfile, init, __FILE__] + mrbs do |t|
_pp "GEN", "*.rb", "#{clib.relative_path}"
FileUtils.mkdir_p File.dirname(clib)
open(clib, 'w') do |f|
diff --git a/test/t/nomethoderror.rb b/test/t/nomethoderror.rb
index 561e545f9..709d31165 100644
--- a/test/t/nomethoderror.rb
+++ b/test/t/nomethoderror.rb
@@ -11,3 +11,16 @@ end
assert('NoMethodError superclass', '15.2.32.2') do
assert_equal NameError, NoMethodError.superclass
end
+
+assert('NoMethodError#args', '15.2.32.2.1') do
+ a = NoMethodError.new 'test', :test, [1, 2]
+ assert_equal [1, 2], a.args
+
+ assert_nothing_raised do
+ begin
+ doesNotExistAsAMethodNameForVerySure 3, 1, 4
+ rescue NoMethodError => e
+ assert_equal [3, 1, 4], e.args
+ end
+ end
+end
diff --git a/test/t/string.rb b/test/t/string.rb
index 5ecb51530..00e98f671 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -320,6 +320,13 @@ assert('String#replace', '15.2.10.5.28') do
b.replace(c);
c.replace(b);
assert_equal c, b
+
+ # shared string
+ s = "foo" * 100
+ a = s[10, 90] # create shared string
+ assert_equal("", s.replace("")) # clear
+ assert_equal("", s) # s is cleared
+ assert_not_equal("", a) # a should not be affected
end
assert('String#reverse', '15.2.10.5.29') do