Sha256: 9cd4a778164994369e231cf894b27566610b0bf7a363faf3484cc5c5c1f0313e
Contents?: true
Size: 952 Bytes
Versions: 2
Compression:
Stored size: 952 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb')) class StructureTest < Test::Unit::TestCase def setup @parser = Bracer.new end test "should create nested set of arrays from s-expression" do ast = @parser.parse_string('[this [is [an [s_expression] [also] blah] foo] [test]]') assert_equal [[:this, [:is, [:an, [:s_expression], [:also], :blah], :foo], [:test]]], ast end test "should create nested set of arrays from s-expression with string literals" do ast = @parser.parse_string('[this [is [an ["s_expression"]]]]') assert_equal [[:this, [:is, [:an, ["s_expression"]]]]], ast end test "should raise error on broken s-expression" do assert_raises Exception do ast = @parser.parse_string('[this [is [an [s_expression] too]') end end test "should parser [] as empty list" do ast = @parser.parse_string('[]') assert_equal [[]], ast end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bracer-0.0.2 | test/unit/structure_test.rb |
bracer-0.0.1 | test/unit/structure_test.rb |