Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: pkg/analysis_server/test/completion_test.dart

Issue 810063002: Add methods to mock SDK that are referenced by completion tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.completion.support; 5 library test.completion.support;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 buildTests('testCommentSnippets044', ''' 228 buildTests('testCommentSnippets044', '''
229 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', 229 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''',
230 <String>["1+List", "1+XXX.fisk"], 230 <String>["1+List", "1+XXX.fisk"],
231 failingTests: '1'); 231 failingTests: '1');
232 232
233 buildTests('testCommentSnippets047', ''' 233 buildTests('testCommentSnippets047', '''
234 f(){int x;int y=!1;}''', <String>["1+x"]); 234 f(){int x;int y=!1;}''', <String>["1+x"]);
235 235
236 buildTests('testCommentSnippets048', ''' 236 buildTests('testCommentSnippets048', '''
237 import 'dart:convert' as json;f() {var x=new js!1}''', 237 import 'dart:convert' as json;f() {var x=new js!1}''',
238 <String>["1+json"], 238 <String>["1+json"]);
239 failingTests: '1');
240 239
241 buildTests('testCommentSnippets049', ''' 240 buildTests('testCommentSnippets049', '''
242 import 'dart:convert' as json; 241 import 'dart:convert' as json;
243 import 'dart:convert' as jxx; 242 import 'dart:convert' as jxx;
244 class JsonParserX{} 243 class JsonDecoderX{}
245 f1() {var x=new !2j!1s!3}''', 244 f1() {var x=new !2j!1s!3}''',
246 <String>[ 245 <String>[
247 "1+json", 246 "1+json",
248 "1+jxx", 247 "1+jxx",
249 "2+json", 248 "2+json",
250 "2+jxx", 249 "2+jxx",
251 "2-JsonParser", 250 "2-JsonDecoder",
252 "3+json", 251 "3+json",
253 "3-jxx"], 252 "3-jxx"]);
254 failingTests: '123');
255 253
256 buildTests('testCommentSnippets050', ''' 254 buildTests('testCommentSnippets050', '''
257 class xdr { 255 class xdr {
258 xdr(); 256 xdr();
259 const xdr.a(a,b,c); 257 const xdr.a(a,b,c);
260 xdr.b(); 258 xdr.b();
261 f() => 3; 259 f() => 3;
262 } 260 }
263 class xa{} 261 class xa{}
264 k() { 262 k() {
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 a..!1 aaa(); 846 a..!1 aaa();
849 }''', <String>["1+aaa", "1-main"]); 847 }''', <String>["1+aaa", "1-main"]);
850 848
851 buildTests('testCompletion_combinator_afterComma', ''' 849 buildTests('testCompletion_combinator_afterComma', '''
852 "import 'dart:math' show cos, !1;''', 850 "import 'dart:math' show cos, !1;''',
853 <String>["1+PI", "1+sin", "1+Random", "1-String"], 851 <String>["1+PI", "1+sin", "1+Random", "1-String"],
854 failingTests: '1'); 852 failingTests: '1');
855 853
856 buildTests('testCompletion_combinator_ended', ''' 854 buildTests('testCompletion_combinator_ended', '''
857 import 'dart:math' show !1;"''', 855 import 'dart:math' show !1;"''',
858 <String>["1+PI", "1+sin", "1+Random", "1-String"], 856 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
859 failingTests: '1');
860 857
861 buildTests('testCompletion_combinator_export', ''' 858 buildTests('testCompletion_combinator_export', '''
862 export 'dart:math' show !1;"''', 859 export 'dart:math' show !1;"''',
863 <String>["1+PI", "1+sin", "1+Random", "1-String"], 860 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
864 failingTests: '1');
865 861
866 buildTests('testCompletion_combinator_hide', ''' 862 buildTests('testCompletion_combinator_hide', '''
867 import 'dart:math' hide !1;"''', 863 import 'dart:math' hide !1;"''',
868 <String>["1+PI", "1+sin", "1+Random", "1-String"], 864 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
869 failingTests: '1');
870 865
871 buildTests('testCompletion_combinator_notEnded', ''' 866 buildTests('testCompletion_combinator_notEnded', '''
872 import 'dart:math' show !1"''', 867 import 'dart:math' show !1"''',
873 <String>["1+PI", "1+sin", "1+Random", "1-String"], 868 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
874 failingTests: '1');
875 869
876 buildTests('testCompletion_combinator_usePrefix', ''' 870 buildTests('testCompletion_combinator_usePrefix', '''
877 import 'dart:math' show s!1"''', 871 import 'dart:math' show s!1"''',
878 <String>["1+sin", "1+sqrt", "1-cos", "1-String"], 872 <String>["1+sin", "1+sqrt", "1-cos", "1-String"]);
879 failingTests: '1');
880 873
881 buildTests('testCompletion_constructor_field', ''' 874 buildTests('testCompletion_constructor_field', '''
882 class X { X(this.field); int f!1ield;}''', 875 class X { X(this.field); int f!1ield;}''',
883 <String>["1+field"], 876 <String>["1+field"],
884 failingTests: '1'); 877 failingTests: '1');
885 878
886 buildTests('testCompletion_constructorArguments_showOnlyCurrent', ''' 879 buildTests('testCompletion_constructorArguments_showOnlyCurrent', '''
887 class A { 880 class A {
888 A.first(int p); 881 A.first(int p);
889 A.second(double p); 882 A.second(double p);
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 buildTests('test_importPrefix_hideCombinator', ''' 1550 buildTests('test_importPrefix_hideCombinator', '''
1558 import 'dart:math' as math hide PI; 1551 import 'dart:math' as math hide PI;
1559 main() { 1552 main() {
1560 math.!1 1553 math.!1
1561 }''', <String>["1-PI", "1+LN10"], failingTests: '1'); 1554 }''', <String>["1-PI", "1+LN10"], failingTests: '1');
1562 1555
1563 buildTests('test_importPrefix_showCombinator', ''' 1556 buildTests('test_importPrefix_showCombinator', '''
1564 import 'dart:math' as math show PI; 1557 import 'dart:math' as math show PI;
1565 main() { 1558 main() {
1566 math.!1 1559 math.!1
1567 }''', <String>["1+PI", "1-LN10"]); 1560 }''', <String>["1+PI", "1-LN10"], failingTests: '1');
1568 1561
1569 sources.clear(); 1562 sources.clear();
1570 sources["/lib.dart"] = ''' 1563 sources["/lib.dart"] = '''
1571 library lib 1564 library lib
1572 class _A 1565 class _A
1573 foo() {} 1566 foo() {}
1574 1567
1575 class A extends _A { 1568 class A extends _A {
1576 }'''; 1569 }''';
1577 buildTests('test_memberOfPrivateClass_otherLibrary', ''' 1570 buildTests('test_memberOfPrivateClass_otherLibrary', '''
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 <String>["1+SerializationException"], 1615 <String>["1+SerializationException"],
1623 extraFiles: sources, 1616 extraFiles: sources,
1624 failingTests: '1'); 1617 failingTests: '1');
1625 1618
1626 // Type propagation. 1619 // Type propagation.
1627 // TODO Include corelib analysis (this works in the editor) 1620 // TODO Include corelib analysis (this works in the editor)
1628 buildTests( 1621 buildTests(
1629 'test002', 1622 'test002',
1630 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''', 1623 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''',
1631 <String>["1+length", "1+isEmpty", "2+clear"], 1624 <String>["1+length", "1+isEmpty", "2+clear"],
1632 failingTests: '12'); 1625 failingTests: '1');
1633 1626
1634 // TODO Include corelib analysis 1627 // TODO Include corelib analysis
1635 buildTests( 1628 buildTests(
1636 'test003', 1629 'test003',
1637 '''class X{var q; f() {q.!1a!2}}''', 1630 '''class X{var q; f() {q.!1a!2}}''',
1638 <String>["1+end", "2+abs", "2-end"], 1631 <String>["1+end", "2+abs", "2-end"],
1639 failingTests: '12'); 1632 failingTests: '12');
1640 1633
1641 // TODO Include corelib analysis 1634 // TODO Include corelib analysis
1642 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s 1635 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s
1643 buildTests('test004', ''' 1636 buildTests('test004', '''
1644 library foo; 1637 library foo;
1645 import 'dart:convert' as json; 1638 import 'dart:convert' as json;
1646 class JsonParserX{} 1639 class JsonDecoderX{}
1647 f1() {var x=new json.!1} 1640 f1() {var x=new json.!1}
1648 f2() {var x=new json.JsonPa!2} 1641 f2() {var x=new json.JsonDe!2}
1649 f3() {var x=new json.JsonParser!3}''', 1642 f3() {var x=new json.JsonDecoder!3}''',
1650 <String>[ 1643 <String>[
1651 "1+JsonParser", 1644 "1+JsonDecoder",
1652 "1-JsonParserX", 1645 "1-JsonDecoderX",
1653 "2+JsonParser", 1646 "2+JsonDecoder",
1654 "2-JsonParserX", 1647 "2-JsonDecoderX",
1655 "3+JsonParser", 1648 "3+JsonDecoder",
1656 "3-JsonParserX"], 1649 "3-JsonDecoderX"]);
1657 failingTests: '123');
1658 1650
1659 // TODO Enable after type propagation is implemented. Not yet. 1651 // TODO Enable after type propagation is implemented. Not yet.
1660 // TODO Include corelib analysis 1652 // TODO Include corelib analysis
1661 buildTests( 1653 buildTests(
1662 'test005', 1654 'test005',
1663 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', 1655 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''',
1664 <String>["1+abs"], 1656 <String>["1+abs"],
1665 failingTests: '1'); 1657 failingTests: '1');
1666 1658
1667 // Exercise import and export handling. 1659 // Exercise import and export handling.
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 } else { 2376 } else {
2385 ++expectedPassCount; 2377 ++expectedPassCount;
2386 test("$baseName-${spec.id}", () { 2378 test("$baseName-${spec.id}", () {
2387 CompletionTestCase test = new CompletionTestCase(); 2379 CompletionTestCase test = new CompletionTestCase();
2388 return test.runTest(spec, extraFiles); 2380 return test.runTest(spec, extraFiles);
2389 }); 2381 });
2390 } 2382 }
2391 } 2383 }
2392 } 2384 }
2393 } 2385 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698