Permalink
Browse files

Refactor syntax quote spec

  • Loading branch information...
1 parent c85702f commit 96d26153ae4f308768587e39d7ae89852726405a @programble programble committed Apr 23, 2013
Showing with 21 additions and 16 deletions.
  1. +21 −16 spec/reader_spec.rb
View
@@ -266,46 +266,51 @@ def expect_syntax_error(s)
read_one('`1').should == 1
read_one('`~1').should == 1
+ apply = Identifier.intern(:apply)
+ concat = Identifier.intern(:concat)
+ list = Identifier.intern(:list)
+ quote = Identifier.intern(:quote)
+
begin
old_gensym = Apricot.instance_variable_get :@gensym
Apricot.instance_variable_set :@gensym, 41
read_one("`(foo ~bar ~@baz quux#)").should ==
- List[Identifier.intern(:concat),
- List[Identifier.intern(:list),
- List[Identifier.intern(:quote),
+ List[concat,
+ List[list,
+ List[quote,
Identifier.intern(:foo)]],
- List[Identifier.intern(:list),
+ List[list,
Identifier.intern(:bar)],
Identifier.intern(:baz),
- List[Identifier.intern(:list),
- List[Identifier.intern(:quote),
+ List[list,
+ List[quote,
Identifier.intern(:'quux#__42')]]]
ensure
Apricot.instance_variable_set :@gensym, old_gensym
end
read_one('`[~a]').should ==
- List[Identifier.intern(:apply),
+ List[apply,
Identifier.intern(:array),
- List[Identifier.intern(:concat),
- List[Identifier.intern(:list),
+ List[concat,
+ List[list,
Identifier.intern(:a)]]]
read_one('`{:a ~b}').should ==
- List[Identifier.intern(:apply),
+ List[apply,
Identifier.intern(:hash),
- List[Identifier.intern(:concat),
- List[Identifier.intern(:list),
+ List[concat,
+ List[list,
:a],
- List[Identifier.intern(:list),
+ List[list,
Identifier.intern(:b)]]]
read_one('`#{~a}').should ==
- List[Identifier.intern(:apply),
+ List[apply,
Identifier.intern(:'hash-set'),
- List[Identifier.intern(:concat),
- List[Identifier.intern(:list),
+ List[concat,
+ List[list,
Identifier.intern(:a)]]]
end

0 comments on commit 96d2615

Please sign in to comment.