start rubymotion-specific String specs

This commit is contained in:
Laurent Sansonetti
2014-04-14 00:12:32 +02:00
parent abc2d17a9b
commit 2a6e833ed3
2 changed files with 14 additions and 1 deletions

View File

@@ -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

View File

@@ -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