From 2a6e833ed392013ad3ba61874bbdfbe458dfb1c7 Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Mon, 14 Apr 2014 00:12:32 +0200 Subject: [PATCH] start rubymotion-specific String specs --- test/test-android/app/main.rb | 2 +- test/test-android/app/rubymotion/string_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/test-android/app/rubymotion/string_spec.rb diff --git a/test/test-android/app/main.rb b/test/test-android/app/main.rb index a84d96bb..b1e3a01a 100644 --- a/test/test-android/app/main.rb +++ b/test/test-android/app/main.rb @@ -14,7 +14,7 @@ class ShouldResult < Java::Lang::Object def ==(x) if (@obj == x) != @res - puts "Expectation failed (expected `#{@obj}' == `#{x}')" + puts "Expectation failed (expected `#{@obj}' (#{@obj.class}) == `#{x}' (#{x.class}))" $expectations_failures += 1 end $expectations_total += 1 diff --git a/test/test-android/app/rubymotion/string_spec.rb b/test/test-android/app/rubymotion/string_spec.rb new file mode 100644 index 00000000..29ac686e --- /dev/null +++ b/test/test-android/app/rubymotion/string_spec.rb @@ -0,0 +1,13 @@ +describe "Strings" do + it "are based on com.rubymotion.String" do + 'foo'.class.should == String + 'foo'.class.inspect.should == 'com.rubymotion.String' + end + + it "can be passed to Java methods expecting a java.lang.CharSequence" do + str_builder = Java::Lang::StringBuilder.new + str_builder.append('hello') + str_builder.append(' world') + str_builder.toString.should == 'hello world' + end +end