From 9fe7aed134078b730226b3f76d98cf2c624ab278 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 28 Oct 2014 15:54:21 -0400 Subject: [PATCH] Started adding specs for type definitions and annotations --- spec/parser_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index f22ee3f..d7f0247 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -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 -- 2.52.0