Sha256: 5b841c81f39a825b21a5902fd48507677576d058ee18ae99c78492516d2eab97

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 Bytes

Contents

require 'helper'

class TestParser < Test::Unit::TestCase
  
  EXPRESSIONS = File.readlines(File.join(File.dirname(__FILE__), "test_parser_ok.txt"))
  BUILT_EXPRESSIONS = File.readlines(File.join(File.dirname(__FILE__), "test_parser_build.txt"))
  
  context "The PLangParser" do
    setup do
      @parser = PLangParser.new
    end
    
    EXPRESSIONS.each_with_index do |expr, i|
      should "parse the expression ##{i}" do
        assert @parser.parse expr
      end
    end

    EXPRESSIONS.each_with_index do |expr, i|
      should "build the expression ##{i}" do
        assert_equal eval(BUILT_EXPRESSIONS[i]), @parser.parse(expr).build.collect(&:to_sexp)
      end
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
p-lang-0.1.1 test/test_parser.rb
p-lang-0.1.0 test/test_parser.rb
p-lang-0.0.4 test/test_parser.rb
p-lang-0.0.3 test/test_parser.rb
p-lang-0.0.2 test/test_parser.rb
p-lang-0.0.1 test/test_parser.rb