Sha256: 95dce87cff8d85f3799d85a48accb7c01b6dbe3c4b9bf1590cb01ab378ff4b01

Contents?: true

Size: 1.28 KB

Versions: 31

Compression:

Stored size: 1.28 KB

Contents

describe "NSData" do

  it "native methods should work - ASCII" do
    NSString.stringWithUTF8String('test'.dataUsingEncoding(NSUTF8StringEncoding)).should == 'test'
    NSString.stringWithUTF8String('test'.nsdata).should == 'test'
  end

  it "native methods should work - unicode" do
    NSString.stringWithUTF8String("t\u0113st".dataUsingEncoding(NSUTF8StringEncoding)).should == "t\u0113st"
    NSString.stringWithUTF8String("t\u0113st".nsdata).should == "t\u0113st"
  end

  it "native methods should work - turkey" do
    NSString.stringWithUTF8String("\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb".dataUsingEncoding(NSUTF8StringEncoding)).should == "\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb"
    NSString.stringWithUTF8String("\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb".nsdata).should == "\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb"
  end

  it "should be able to create an ASCII string from data" do
    'test'.nsdata.nsstring.should == 'test'
  end

  it "should be able to create a unicode string from data" do
    "t\u0113st".nsdata.nsstring.should == "t\u0113st"
  end

  it "should be able to create a turkey string from data" do
    "\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb".nsdata.nsstring.should == "\u00ab\u03c4\u03b1\u0411\u042c\u2113\u03c3\u00bb"
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
sugarcube-0.20.5 spec/nsdata_spec.rb
sugarcube-0.20.4 spec/nsdata_spec.rb
sugarcube-0.20.3 spec/nsdata_spec.rb
sugarcube-0.20.1 spec/nsdata_spec.rb
sugarcube-0.20.0 spec/nsdata_spec.rb
sugarcube-0.19.5 spec/nsdata_spec.rb
sugarcube-0.19.4 spec/nsdata_spec.rb
sugarcube-0.19.2 spec/nsdata_spec.rb
sugarcube-0.19.0 spec/nsdata_spec.rb
sugarcube-0.18.21 spec/nsdata_spec.rb
sugarcube-0.18.20 spec/nsdata_spec.rb
sugarcube-0.18.19 spec/nsdata_spec.rb
sugarcube-0.18.18 spec/nsdata_spec.rb
sugarcube-0.18.17 spec/nsdata_spec.rb
sugarcube-0.18.16 spec/nsdata_spec.rb
sugarcube-0.18.12 spec/nsdata_spec.rb
sugarcube-0.18.11 spec/nsdata_spec.rb
sugarcube-0.18.10 spec/nsdata_spec.rb
sugarcube-0.18.9 spec/nsdata_spec.rb
sugarcube-0.18.8 spec/nsdata_spec.rb