Sha256: ff4ecb3ea86a6e8a96424b9ed1e722e2a7e7ce93cece16a869231e00b0c6c9b7

Contents?: true

Size: 998 Bytes

Versions: 42

Compression:

Stored size: 998 Bytes

Contents

describe "Ruby character strings" do
  it "are produced from character shortcuts" do
    ?z.should == 'z'
  end

  it "should parse string into %[]" do 
    %[foo].should == "foo"
    %|bar|.should == "bar"
    %'baz'.should == "baz"
  end

  it "interpolate string" do 
    a = 1
    %[#{a}23].should == "123"
  end

  it "should not process escape characters in single-quoted heredocs" do
    s = <<'EOD'
      hey\now\brown\cow
    EOD
    s.strip.should == 'hey\now\brown\cow'
  end

  it "should ignore single-quote escapes in single-quoted heredocs" do
    s = <<'EOD'
      they\'re greeeeaaat!
    EOD
    s.strip.should == 'they\\\'re greeeeaaat!'
  end

  it "should process escape characters in double quoted heredocs" do
    s = <<"EOD"
      hey\now\brown\cow
    EOD
    s.strip.should == "hey\now\brown\cow"
  end

  it "should treat bare-word heredoc identifiers as double-quoted" do
    s = <<EOD
      hey\now\brown\cow
    EOD
    s.strip.should == "hey\now\brown\cow"
  end
end

Version data entries

42 entries across 42 versions & 3 rubygems

Version Path
opal-0.6.2 spec/opal/core/language/string_spec.rb
opal-0.6.1 spec/opal/core/language/string_spec.rb