Sha256: 43619d19186734c3971413bad34659ee70559072ec7bbd84363a02b99e6012dd

Contents?: true

Size: 966 Bytes

Versions: 1

Compression:

Stored size: 966 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

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.11.0.rc1 spec/opal/core/language/string_spec.rb