Sha256: 39a6821ab231555d5067511d4ea72c2113bcfc1d6b656666a528be1fe8718980
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb')) class ToSexpTest < Test::Unit::TestCase def setup @parser = Bracer.new end test "should convert nested arrays back into an S-Expression" do ast = [:string, [:is, [:parsed]]] sexp = @parser.to_sexp(ast) assert_equal "[string [is [parsed]]]", sexp end test "should structure containing integers and strings back into an S-Expression" do ast = ["String!", [1, [2, "Other string."]]] sexp = @parser.to_sexp(ast) assert_equal "[String! [1 [2 Other string.]]]", sexp end test "should not output true and false using scheme notation when scheme compat is off" do ast = [true, [false, [true, false]]] sexp = @parser.to_sexp(ast) assert_equal "[true [false [true false]]]", sexp end test "when not passed array to_sexp should print value [integer]" do ast = 1 sexp = @parser.to_sexp(ast) assert_equal "1", sexp end test "when not passed array to_sexp should print value [string]" do ast = "test" sexp = @parser.to_sexp(ast) assert_equal "test", sexp end test "when not passed array to_sexp should print value [symbol]" do ast = :test sexp = @parser.to_sexp(ast) assert_equal "test", sexp end test "lists passed to to_sexp should have not extraneous spaces" do ast = [1, 2, 3] sexp = @parser.to_sexp(ast) assert_equal "[1 2 3]", sexp end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bracer-0.0.1 | test/unit/to_sexp_test.rb |