Sha256: fcfe036efddbed98746f6f2784f3ea8e4fd522a12030407abac4a1f4d8b362f1

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

class SymbolTest < Test::Unit::TestCase

  def setup
    @parser = Sexpistol.new
  end

  test "should parse simple symbol" do
    ast = @parser.parse_string("test")
    assert_equal [:test], ast
  end
  
  test "should parse symbol with trailing exclamation mark" do
    ast = @parser.parse_string("test!")
    assert_equal [:test!], ast
  end
  
  test "should parse symbol with trailing question mark" do
    ast = @parser.parse_string("test?")
    assert_equal [:test?], ast
  end
  
  test "should parse symbol containing underscores" do
    ast = @parser.parse_string("te__st")
    assert_equal [:te__st], ast
  end
  
  test "should parse symbol with leading underscores" do
    ast = @parser.parse_string("__test")
    assert_equal [:__test], ast
  end
  
  test "should parse symbol with trailing underscores" do
    ast = @parser.parse_string("test__")
    assert_equal [:test__], ast
  end
    
  test "should parse CamelCase symbol" do
    ast = @parser.parse_string("TestSymbol")
    assert_equal [:TestSymbol], ast
  end
  
  test "should parse complex symbol" do
    ast = @parser.parse_string("__TestSymbol_TEST__?")
    assert_equal [:__TestSymbol_TEST__?], ast
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

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