public
Fork of nathansobo/treetop
Description: A Ruby-based parsing DSL based on parsing expression grammars.
Homepage: http://treetop.rubyforge.org
Clone URL: git://github.com/juretta/treetop.git
Search Repo:
Fleshed out pending specs a little
Nathan Sobo (author)
Tue Mar 04 22:05:26 -0800 2008
commit  3f2a1080557e763642d56a95de0a637a63b0fffd
tree    a19b5023268f8a27defb132e8e4b96329ec7772c
parent  1a2c13aa09755324fd832e16341d6da351df8970
...
19
20
21
22
 
 
 
 
 
 
 
23
24
 
 
 
 
 
 
25
26
27
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
30
31
...
19
20
21
 
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
 
 
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
0
@@ -19,13 +19,41 @@ module ChoiceSpec
0
     end
0
     
0
     
0
- it "upon parsing a string matching the first alternative, returns a Propagation with the result of the first alternative as its result"
0
+ it "upon parsing a string matching the first alternative, returns a Propagation with the result of the first alternative as its result" do
0
+ pending
0
+ result = parse('foo')
0
+ result.should be_an_instance_of(Runtime::Propagation)
0
+ result.element.should be_terminal
0
+ result.element.text_value.should == 'foo'
0
+ end
0
     
0
     describe "upon parsing a string matching the second alternative" do
0
+ attr_reader :result
0
+
0
+ before do
0
+ @result = parse('bar')
0
+ end
0
+
0
       describe "the result" do
0
- it "is an instance Propagation"
0
- it "has the result of the second alternative as its #result"
0
- it "has the failing result of the first alternative and the successful result of the second alternative as its dependencies"
0
+ it "is an instance Propagation" do
0
+ pending
0
+ result.should be_an_instance_of(Runtime::Propagation)
0
+ end
0
+
0
+ it "has the result of the second alternative as its #element" do
0
+ pending
0
+ result.element.should be_terminal
0
+ result.element.text_value.should == 'bar'
0
+ end
0
+
0
+ it "has the failing result of the first alternative and the successful result of the second alternative as its dependencies" do
0
+ pending
0
+ dependencies = result.dependencies
0
+ dependencies.size.should == 2
0
+ dependencies[0].should be_an_instance_of(Runtime::TerminalParseFailure)
0
+ dependencies[0].expected_string.should == 'foo'
0
+ dependencies[1].should == result.element
0
+ end
0
       end
0
       
0
       it "records the failure of the first terminal"
...
18
19
20
21
22
23
24
25
...
18
19
20
 
21
 
22
23
0
@@ -18,7 +18,5 @@ module PropagationSpec
0
     it "returns the propagated SyntaxNode as its only dependency" do
0
       propagation.dependencies.should == [propagated_syntax_node]
0
     end
0
-
0
   end
0
-
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.