Sha256: 45cf83befd25ce1a4f529d0b17453487063140e7726ec2a2de2a4c04df938275
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe "Heredocs" do it "parses as a s(:str)" do opal_parse("a = <<-FOO\nbar\nFOO")[2].should == [:str, "bar\n"] end it "allows start marker to be wrapped in quotes" do opal_parse("a = <<-'FOO'\nbar\nFOO")[2].should == [:str, "bar\n"] opal_parse("a = <<-\"FOO\"\nbar\nFOO")[2].should == [:str, "bar\n"] end it "does not parse EOS unless beginning of line" do opal_parse("<<-FOO\ncontentFOO\nFOO").should == [:str, "contentFOO\n"] end it "does not parse EOS unless end of line" do opal_parse("<<-FOO\nsome FOO content\nFOO").should == [:str, "some FOO content\n"] end it "parses postfix code as if it appeared after heredoc" do opal_parse("<<-FOO.class\ncode\nFOO").should == [:call, [:str, "code\n"], :class, [:arglist]] opal_parse("bar(<<-FOO, 1, 2, 3)\ncode\nFOO").should == [:call, nil, :bar, [:arglist, [:str, "code\n"], [:int, 1], [:int, 2], [:int, 3]]] end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opal-0.5.5 | spec/opal/parser/heredoc_spec.rb |
opal-0.5.4 | spec/opal/parser/heredoc_spec.rb |
opal-0.5.2 | spec/opal/parser/heredoc_spec.rb |
opal-0.5.0 | spec/opal/parser/heredoc_spec.rb |