Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index bc04b436d2ef5a15dce4280f693b7bf900823941..597bc40c7ac74013ec779166a1fcfa16aee225a2 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -7910,3 +7910,36 @@ TEST(TypedModeClassDeclarations) { |
RunParserSyncTest(typed_context_data, error_data, kError, NULL, 0, |
always_flags, arraysize(always_flags)); |
} |
+ |
+TEST(TypedModeInterfaceDeclarations) { |
+ const char* untyped_context_data[][2] = {{"", ""}, {NULL, NULL}}; |
+ const char* typed_context_data[][2] = {{"'use types'; ", ""}, {NULL, NULL}}; |
+ |
+ const char* correct_data[] = { |
+ "interface I { f(x: number) : boolean }", |
+ "interface J extends I { g(x: number) : boolean }", |
+ "interface K extends I, J { h(x: number) : boolean }", |
+ "interface I<A> {}", |
+ "interface I<A, B> extends A, J<B> {}", |
+ NULL |
+ }; |
+ |
+ const char* error_data[] = { |
+ "interface I { x: () }", |
+ "interface {}", |
+ "interface extends I {}", |
+ "interface I { f(a: ()) }", |
+ "interface I<> {}", |
+ NULL |
+ }; |
+ |
+ static const ParserFlag always_flags[] = {kAllowTypes}; |
+ RunParserSyncTest(untyped_context_data, correct_data, kError, NULL, 0, |
+ always_flags, arraysize(always_flags)); |
+ RunParserSyncTest(typed_context_data, correct_data, kSuccess, NULL, 0, |
+ always_flags, arraysize(always_flags)); |
+ RunParserSyncTest(untyped_context_data, error_data, kError, NULL, 0, |
+ always_flags, arraysize(always_flags)); |
+ RunParserSyncTest(typed_context_data, error_data, kError, NULL, 0, |
+ always_flags, arraysize(always_flags)); |
+} |