Sha256: 01107ee79291e99696d9ed073136582751fec798507b6a414585c4c568ea181a

Contents?: true

Size: 1.16 KB

Versions: 1

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 = Bracer.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

1 entries across 1 versions & 1 rubygems

Version Path
bracer-0.0.2 test/unit/ruby_keyword_literals_test.rb