Sha256: 281589818987f4cdc53caa58f50f6466a8bf397aaa3105138a782fe0fc515152

Contents?: true

Size: 789 Bytes

Versions: 6

Compression:

Stored size: 789 Bytes

Contents

require "spec_helper"

RSpec.describe Code::Parser::String do
  subject { described_class.new.parse(input) }

  [
    ["'hello'", { string: "hello" }],
    ['"hello"', { string: "hello" }],
    ["''", { string: "" }],
    ['""', { string: "" }],
    ["'\\''", { string: "'" }],
    ['"\\t"', { string: "\\t" }],
    ["'\\r'", { string: "\\r" }],
    ['"\\b\\f\\n\\r\\t"', { string: "\\b\\f\\n\\r\\t" }],
    ['"\\uABCG"', { string: "uABCG" }],
    [
      "'\\u0123\\u4567\\u89aA\\ubBcC\\UdDeE\\ufFfF'",
      { string: "\\u0123\\u4567\\u89aA\\ubBcC\\UdDeE\\ufFfF" },
    ],
    [":asc", { string: "asc" }],
  ].each do |(input, expected)|
    context input.inspect do
      let(:input) { input }

      it "succeeds" do
        expect(subject).to eq(expected)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
code-ruby-0.2.4 spec/code/parser/string_spec.rb
template-ruby-0.2.4 spec/code/parser/string_spec.rb
template-ruby-0.2.3 spec/code/parser/string_spec.rb
template-ruby-0.2.2 spec/code/parser/string_spec.rb
template-ruby-0.2.1 spec/code/parser/string_spec.rb
template-ruby-0.2.0 spec/code/parser/string_spec.rb