| Index: editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java
|
| ===================================================================
|
| --- editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java (revision 13022)
|
| +++ editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/completion/CompletionEngineTest.java (working copy)
|
| @@ -444,7 +444,103 @@
|
| test(source, "1-toUpperCase", "2+toUpperCase");
|
| }
|
|
|
| - public void testCommentSnippets064() throws Exception {
|
| + public void testCompletion_alias_field() throws Exception {
|
| + // fails because test framework does not set compilation unit
|
| + // tests cannot check completion of any type defined in the test
|
| +// test("typedef int fnint(int k); fn!1int x;", "1+fnint");
|
| + }
|
| +
|
| + public void testCompletion_constructor_field() throws Exception {
|
| + test("class X { X(this.field); int f!1ield;}", "1+field");
|
| + }
|
| +
|
| + public void testCompletion_forStmt_vars() throws Exception {
|
| + test("class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}", "1+int", "2+i", "3+i");
|
| +// "2-int", "3-int"); // not clear these negative results should be eliminated
|
| + }
|
| +
|
| + public void testCompletion_function() throws Exception {
|
| + test(
|
| + "class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b)); }}",
|
| + "1+String");
|
| + }
|
| +
|
| + public void testCompletion_function_partial() throws Exception {
|
| + // TODO waiting on fix to issue 884
|
| +// test("class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}", "1+String");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_field1() throws Exception {
|
| + test("class Foo { int myField = 7; mth() { if (!1) {}}}", "1+myField");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_field1a() throws Exception {
|
| + test("class Foo { int myField = 7; mth() { if (!1) }}", "1+myField");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_field2() throws Exception {
|
| + test("class Foo { int myField = 7; mth() { if (m!1) {}}}", "1+myField");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_field2a() throws Exception {
|
| + test("class Foo { int myField = 7; mth() { if (m!1) }}", "1+myField");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_field2b() throws Exception {
|
| + test("class Foo { myField = 7; mth() { if (m!1) {}}}", "1+myField");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_localVar() throws Exception {
|
| + test("class Foo { mth() { int value = 7; if (v!1) {}}}", "1+value");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_localVara() throws Exception {
|
| + test("class Foo { mth() { value = 7; if (v!1) {}}}", "1-value");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_topLevelVar() throws Exception {
|
| + test("int topValue = 7; class Foo { mth() { if (t!1) {}}}", "1+topValue");
|
| + }
|
| +
|
| + public void testCompletion_ifStmt_topLevelVara() throws Exception {
|
| + test("topValue = 7; class Foo { mth() { if (t!1) {}}}", "1+topValue");
|
| + }
|
| +
|
| + public void testCompletion_keyword_in() throws Exception {
|
| + test("class Foo { int input = 7; mth() { if (in!1) {}}}", "1+input");
|
| + }
|
| +
|
| + public void testCompletion_newMemberType1() throws Exception {
|
| + test("class Foo { !1 }", "1+Collection", "1+List");
|
| + }
|
| +
|
| + public void testCompletion_newMemberType2() throws Exception {
|
| + test("class Foo {!1}", "1+Collection", "1+List");
|
| + }
|
| +
|
| + public void testCompletion_newMemberType3() throws Exception {
|
| + test("class Foo {L!1}", "1-Collection", "1+List");
|
| + }
|
| +
|
| + public void testCompletion_newMemberType4() throws Exception {
|
| + test("class Foo {C!1}", "1+Collection", "1-List");
|
| + }
|
| +
|
| + public void testCompletion_staticField1() throws Exception {
|
| + test(
|
| + // cannot complete Sunflower due to bug in test framework
|
| + "class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sunflower() {x!Xc = y!Yc = MA!1 }}", "1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num");
|
| + }
|
| +
|
| + public void testCompletion_topLevelField_init2() throws Exception {
|
| + test("final num M = Dat!1e.JUN;", "1+Date", "1-void");
|
| + }
|
| +
|
| + public void testCompletion_while() throws Exception {
|
| + test("class Foo { int boo = 7; mth() { while (b!1) {} }}", "1+boo");
|
| + }
|
| +
|
| + public void xtestCommentSnippets064() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -472,7 +568,7 @@
|
| test(source, "1+a", "2+b", "1-g", "2-h", "3+b", "4+c", "5+a", "6+c", "7+f", "8+j", "9+h");
|
| }
|
|
|
| - public void testCommentSnippets065() throws Exception {
|
| + public void xtestCommentSnippets065() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -499,7 +595,7 @@
|
| test(source, "1+a");
|
| }
|
|
|
| - public void testCommentSnippets066() throws Exception {
|
| + public void xtestCommentSnippets066() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -526,7 +622,7 @@
|
| test(source, "1+b");
|
| }
|
|
|
| - public void testCommentSnippets067() throws Exception {
|
| + public void xtestCommentSnippets067() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -553,7 +649,7 @@
|
| test(source, "1+b");
|
| }
|
|
|
| - public void testCommentSnippets068() throws Exception {
|
| + public void xtestCommentSnippets068() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -580,7 +676,7 @@
|
| test(source, "1+c");
|
| }
|
|
|
| - public void testCommentSnippets069() throws Exception {
|
| + public void xtestCommentSnippets069() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -607,7 +703,7 @@
|
| test(source, "1+c");
|
| }
|
|
|
| - public void testCommentSnippets070() throws Exception {
|
| + public void xtestCommentSnippets070() throws Exception {
|
| String source = Joiner.on("\n").join(
|
| "class Spline {",
|
| " Line c;",
|
| @@ -634,121 +730,19 @@
|
| test(source, "1+b");
|
| }
|
|
|
| - public void testCompletion_alias_field() throws Exception {
|
| - // fails because test framework does not set compilation unit
|
| - // tests cannot check completion of any type defined in the test
|
| -// test("typedef int fnint(int k); fn!1int x;", "1+fnint");
|
| - }
|
| -
|
| - public void testCompletion_constructor_field() throws Exception {
|
| - test("class X { X(this.field); int f!1ield;}", "1+field");
|
| - }
|
| -
|
| - public void testCompletion_forStmt_vars() throws Exception {
|
| - test("class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}", "1+int", "2+i", "3+i");
|
| -// "2-int", "3-int"); // not clear these negative results should be eliminated
|
| - }
|
| -
|
| - public void testCompletion_function() throws Exception {
|
| - test(
|
| - "class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b)); }}",
|
| - "1+String");
|
| - }
|
| -
|
| - public void testCompletion_function_partial() throws Exception {
|
| - // TODO waiting on fix to issue 884
|
| -// test("class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}", "1+String");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_field1() throws Exception {
|
| - test("class Foo { int myField = 7; mth() { if (!1) {}}}", "1+myField");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_field1a() throws Exception {
|
| - test("class Foo { int myField = 7; mth() { if (!1) }}", "1+myField");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_field2() throws Exception {
|
| - test("class Foo { int myField = 7; mth() { if (m!1) {}}}", "1+myField");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_field2a() throws Exception {
|
| - test("class Foo { int myField = 7; mth() { if (m!1) }}", "1+myField");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_field2b() throws Exception {
|
| - test("class Foo { myField = 7; mth() { if (m!1) {}}}", "1+myField");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_localVar() throws Exception {
|
| - test("class Foo { mth() { int value = 7; if (v!1) {}}}", "1+value");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_localVara() throws Exception {
|
| - test("class Foo { mth() { value = 7; if (v!1) {}}}", "1-value");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_topLevelVar() throws Exception {
|
| - test("int topValue = 7; class Foo { mth() { if (t!1) {}}}", "1+topValue");
|
| - }
|
| -
|
| - public void testCompletion_ifStmt_topLevelVara() throws Exception {
|
| - test("topValue = 7; class Foo { mth() { if (t!1) {}}}", "1+topValue");
|
| - }
|
| -
|
| - public void testCompletion_keyword_in() throws Exception {
|
| - test("class Foo { int input = 7; mth() { if (in!1) {}}}", "1+input");
|
| - }
|
| -
|
| - public void testCompletion_newMemberType1() throws Exception {
|
| - test("class Foo { !1 }", "1+Collection", "1+List");
|
| - }
|
| -
|
| - public void testCompletion_newMemberType2() throws Exception {
|
| - test("class Foo {!1}", "1+Collection", "1+List");
|
| - }
|
| -
|
| - public void testCompletion_newMemberType3() throws Exception {
|
| - test("class Foo {L!1}", "1-Collection", "1+List");
|
| - }
|
| -
|
| - public void testCompletion_newMemberType4() throws Exception {
|
| - test("class Foo {C!1}", "1+Collection", "1-List");
|
| - }
|
| -
|
| - public void testCompletion_staticField1() throws Exception {
|
| - test(
|
| - // cannot complete Sunflower due to bug in test framework
|
| - "class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sunflower() {x!Xc = y!Yc = MA!1 }}",
|
| - "1+MAX_D",
|
| - "X+xc",
|
| - "Y+yc",
|
| - "2+num",
|
| - "3+num");
|
| - }
|
| -
|
| - public void testCompletion_topLevelField_init2() throws Exception {
|
| - test("final num M = Dat!1e.JUN;", "1+Date", "1-void");
|
| - }
|
| -
|
| - public void testCompletion_while() throws Exception {
|
| - test("class Foo { int boo = 7; mth() { while (b!1) {} }}", "1+boo");
|
| - }
|
| -
|
| /**
|
| - * Run a set of completion tests on the given <code>originalSource</code>. The source string has
|
| - * completion points embedded in it, which are identified by '!X' where X is a single character.
|
| - * Each X is matched to positive or negative results in the array of
|
| - * <code>validationStrings</code>. Validation strings contain the name of a prediction with a two
|
| - * character prefix. The first character of the prefix corresponds to an X in the
|
| - * <code>originalSource</code>. The second character is either a '+' or a '-' indicating whether
|
| - * the string is a positive or negative result.
|
| + * Run a set of completion tests on the given <code>originalSource</code>. The source string has completion
|
| + * points embedded in it, which are identified by '!X' where X is a single character. Each X is
|
| + * matched to positive or negative results in the array of <code>validationStrings</code>. Validation strings
|
| + * contain the name of a prediction with a two character prefix. The first character of the prefix
|
| + * corresponds to an X in the <code>originalSource</code>. The second character is either a '+' or a '-'
|
| + * indicating whether the string is a positive or negative result.
|
| *
|
| * @param originalSource The source for a completion test that contains completion points
|
| * @param validationStrings The positive and negative predictions
|
| */
|
| - private void test(String originalSource, String... results) throws URISyntaxException,
|
| - DartModelException {
|
| + private void test(String originalSource, String... results)
|
| + throws URISyntaxException, DartModelException {
|
| Collection<CompletionSpec> completionTests = CompletionSpec.from(originalSource, results);
|
| assertTrue(
|
| "Expected exclamation point ('!') within the source"
|
|
|