]> git.mdlowis.com Git - proto/sclpl.git/commitdiff
Started adding specs for type definitions and annotations
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 28 Oct 2014 19:54:21 +0000 (15:54 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 28 Oct 2014 19:54:21 +0000 (15:54 -0400)
spec/parser_spec.rb

index f22ee3f9a662d27a45419c208f81b1f4e243e06e..d7f024765f92c16858aec311f262b78c20dd39d7 100644 (file)
@@ -27,6 +27,9 @@ describe "sclpl grammar" do
     end
   end
 
+  context "type definitions" do
+  end
+
   context "definitions" do
     it "should parse a value definition" do
       expect(ast('def foo 123;')).to eq([ ['T_ID:def', 'T_ID:foo', 'T_INT:123'] ])
@@ -58,6 +61,19 @@ describe "sclpl grammar" do
     end
   end
 
+  context "annotations" do
+    it "should parse a type annotation" do
+      pending "Type annotations have not been implemented yet"
+      expect(ast('ann foo int;')).to eq([ ['T_ID:ann', 'T_ID:foo', 'T_ID:int'] ])
+    end
+
+    it "should parse a type annotation with a generic type" do
+      pending "Type annotations have not been implemented yet"
+      expect(ast('ann foo Pair[int,int];')).to eq([
+          ['T_ID:ann', 'T_ID:foo', ['T_ID:Pair', 'T_ID:int', 'T_ID:int']] ])
+    end
+  end
+
   context "expressions" do
     context "parenthese grouping" do
       it "should parse a parenthesized expression" do