end
context "type definitions" do
+ it "should parse a simple type definition" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is int;')).to eq([ ['T_ID:type', 'T_ID:foo', 'T_ID:int'] ])
+ end
+
+ it "should parse a function type definition with no args" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is (-> int ());')).to eq([
+ ['T_ID:type', 'T_ID:foo', 'T_ID:is', ['T_ID:->', 'T_ID:int', []]] ])
+ end
+
+ it "should parse a function type definition with one arg" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is (-> int (int));')).to eq([
+ ['T_ID:type', 'T_ID:foo', 'T_ID:is', ['T_ID:->', 'T_ID:int', ['T_ID:int']]] ])
+ end
+
+ it "should parse a function type definition with two args" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is (-> int (int, int));')).to eq([
+ ['T_ID:type', 'T_ID:foo', 'T_ID:is', ['T_ID:->', 'T_ID:int', ['T_ID:int', 'T_ID:int']]] ])
+ end
+
+ it "should parse a function type definition with three args" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is (-> int (int, int, int));')).to eq([
+ ['T_ID:type', 'T_ID:foo', 'T_ID:is', ['T_ID:->', 'T_ID:int', ['T_ID:int', 'T_ID:int', 'T_ID:int']]] ])
+ end
+
+ it "should parse a tuple type definition with one field" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is {int};')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:tuple', 'T_ID:int']] ])
+ end
+
+ it "should parse a tuple type definition with two fields" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is {int,int};')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:tuple', 'T_ID:int', 'T_ID:int']] ])
+ end
+
+ it "should parse a tuple type definition with three fields" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is {int,int,int};')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:tuple', 'T_ID:int', 'T_ID:int', 'T_ID:int']] ])
+ end
+
+ it "should parse a record type definition with one field" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is { int a };')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:record', ['T_ID:int', 'T_ID:a']]] ])
+ end
+
+ it "should parse a record type definition with two fields" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is { int a, int b };')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:record', ['T_ID:int', 'T_ID:a'], ['T_ID:int', 'T_ID:b']]] ])
+ end
+
+ it "should parse a record type definition with three fields" do
+ pending "Type annotations have not been implemented yet"
+ expect(ast('type foo is { int a, int b };')).to eq([
+ ['T_ID:type', 'T_ID:foo', ['T_ID:record', ['T_ID:int', 'T_ID:a'], ['T_ID:int', 'T_ID:b'], ['T_ID:int', 'T_ID:c']]] ])
+ end
+
end
context "definitions" do