Sha256: dff320006e70c1b2ff56566270545c37aac5e29d30f5bbe95c66d7ffbabebc9b
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb')) class SchemeCompatabilityTest < Test::Unit::TestCase def setup @parser = Bracer.new @parser.scheme_compatability = true end test "should parse #t as symbol" do ast = @parser.parse_string('[#t]') assert_equal [[:"#t"]], ast end test "should parse #f as symbol" do ast = @parser.parse_string('[#f]') assert_equal [[:"#f"]], ast end test "should allow comma quoting" do ast = @parser.parse_string("[this is '[ a test] too foo][foo]") assert_equal [[:this, :is, [:quote, [:a, :test]], :too, :foo ],[:foo]], ast end test "should allow complicated comma quoting" do ast = @parser.parse_string("[this is '[ a test] [also]]") assert_equal [[:this, :is, [:quote, [:a, :test]], [:also]]], ast end test "should allow comma quoting of integer literal" do ast = @parser.parse_string "[this is '1 [also]]" assert_equal [[:this, :is, [:quote, 1], [:also]]], ast end test "should allow comma quoting of string literal" do ast = @parser.parse_string("[this is '\"test\" [also]]") assert_equal [[:this, :is, [:quote, "test"], [:also]]], ast end test "should return scheme compatible external representation" do ast = [true, false, nil] string = @parser.to_sexp(ast) assert_equal "[#t #f []]", string end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bracer-0.0.2 | test/unit/scheme_compatability_test.rb |