Sha256: b307fd9c6a12aa0f3f0c5428ca3959750ab2525ed37ad615d95c5ce06fde4b3b

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))

class RubyKeywordLiteralsTest < Test::Unit::TestCase

  def setup
    @parser = Sexpistol.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
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sexpistol-0.0.3 test/unit/structure_test.rb