Sha256: 5182bb44d601fe13cb4f8b7ec38d98cf09e364350ee5fb36d62c4b41819ed096

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))

class StringLiteralTest < Test::Unit::TestCase

  def setup
    @parser = Sexpistol.new
  end

  test "should parse empty string literal" do
    ast = @parser.parse_string('""')
    assert_equal [""], ast
  end

  test "should parse string literal" do
    ast = @parser.parse_string('"test"')
    assert_equal ["test"], ast
  end
  
  test "should parse string literal containing escaped quotes" do
    ast = @parser.parse_string('"te\"st"')
    assert_equal ["te\"st"], ast
  end
  
  test "should parse string literal containing escaped characters" do
    ast = @parser.parse_string('"\n\t\r"')
    assert_equal ["\n\t\r"], ast
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sexpistol-0.0.1 test/unit/string_literal_test.rb