Sha256: e8f27b3f91f2ba8460d3530cd847c141652016f256cfc3a31e2e73e824e71c6e

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

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

class RubyKeywordLiteralsTest < Test::Unit::TestCase

  def setup
    @parser = Sexpistol.new
  end

  test "should parse nil as literal" do
    @parser.ruby_keyword_literals = true
    ast = @parser.parse_string('(nil)')
    assert_equal [[nil]], ast
  end
  
  test "should not parse nil as literal" do
    @parser.ruby_keyword_literals = false
    ast = @parser.parse_string('(nil)')
    assert_equal [[:nil]], ast
  end
  
  test "should parse true as literal" do
    @parser.ruby_keyword_literals = true
    ast = @parser.parse_string('(true)')
    assert_equal [[true]], ast
  end
  
  test "should not parse true as literal" do
    @parser.ruby_keyword_literals = false
    ast = @parser.parse_string('(true)')
    assert_equal [[:true]], ast
  end
  
  test "should parse false as literal" do
    @parser.ruby_keyword_literals = true
    ast = @parser.parse_string('(false)')
    assert_equal [[false]], ast
  end
  
  test "should notparse false as literal" do
    @parser.ruby_keyword_literals = false
    ast = @parser.parse_string('(false)')
    assert_equal [[:false]], ast
  end
    
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
deil_sexpistol-0.0.9 test/unit/ruby_keyword_literals_test.rb
deil_sexpistol-0.0.8 test/unit/ruby_keyword_literals_test.rb
sexpistol-0.0.7 test/unit/ruby_keyword_literals_test.rb