| OLD | NEW |
| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.all_the_rest_test; | 8 library engine.all_the_rest_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 "html", | 119 "html", |
| 120 ht.TokenType.GT | 120 ht.TokenType.GT |
| 121 ]); | 121 ]); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void test_tokenize_directive_incomplete() { | 124 void test_tokenize_directive_incomplete() { |
| 125 _tokenize2("<? \nfoo", <Object>["<? \nfoo"], <int>[0, 4]); | 125 _tokenize2("<? \nfoo", <Object>["<? \nfoo"], <int>[0, 4]); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void test_tokenize_directive_xml() { | 128 void test_tokenize_directive_xml() { |
| 129 _tokenize("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", <Object>[ | 129 _tokenize("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", |
| 130 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" | 130 <Object>["<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"]); |
| 131 ]); | |
| 132 } | 131 } |
| 133 | 132 |
| 134 void test_tokenize_directives_incomplete_with_newline() { | 133 void test_tokenize_directives_incomplete_with_newline() { |
| 135 _tokenize2("<! \nfoo", <Object>["<! \nfoo"], <int>[0, 4]); | 134 _tokenize2("<! \nfoo", <Object>["<! \nfoo"], <int>[0, 4]); |
| 136 } | 135 } |
| 137 | 136 |
| 138 void test_tokenize_empty() { | 137 void test_tokenize_empty() { |
| 139 _tokenize("", <Object>[]); | 138 _tokenize("", <Object>[]); |
| 140 } | 139 } |
| 141 | 140 |
| (...skipping 5557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 expect(typeParameters, hasLength(0)); | 5698 expect(typeParameters, hasLength(0)); |
| 5700 } | 5699 } |
| 5701 | 5700 |
| 5702 void test_visitTypeAlias_withTypeParameters() { | 5701 void test_visitTypeAlias_withTypeParameters() { |
| 5703 ElementHolder holder = new ElementHolder(); | 5702 ElementHolder holder = new ElementHolder(); |
| 5704 ElementBuilder builder = new ElementBuilder(holder); | 5703 ElementBuilder builder = new ElementBuilder(holder); |
| 5705 String aliasName = "F"; | 5704 String aliasName = "F"; |
| 5706 String firstTypeParameterName = "A"; | 5705 String firstTypeParameterName = "A"; |
| 5707 String secondTypeParameterName = "B"; | 5706 String secondTypeParameterName = "B"; |
| 5708 TypeAlias typeAlias = AstFactory.typeAlias(null, aliasName, AstFactory | 5707 TypeAlias typeAlias = AstFactory.typeAlias(null, aliasName, AstFactory |
| 5709 .typeParameterList([ | 5708 .typeParameterList( |
| 5710 firstTypeParameterName, | 5709 [firstTypeParameterName, secondTypeParameterName]), |
| 5711 secondTypeParameterName | 5710 AstFactory.formalParameterList()); |
| 5712 ]), AstFactory.formalParameterList()); | |
| 5713 typeAlias.accept(builder); | 5711 typeAlias.accept(builder); |
| 5714 List<FunctionTypeAliasElement> aliases = holder.typeAliases; | 5712 List<FunctionTypeAliasElement> aliases = holder.typeAliases; |
| 5715 expect(aliases, hasLength(1)); | 5713 expect(aliases, hasLength(1)); |
| 5716 FunctionTypeAliasElement alias = aliases[0]; | 5714 FunctionTypeAliasElement alias = aliases[0]; |
| 5717 expect(alias, isNotNull); | 5715 expect(alias, isNotNull); |
| 5718 expect(alias.name, aliasName); | 5716 expect(alias.name, aliasName); |
| 5719 expect(alias.type, isNotNull); | 5717 expect(alias.type, isNotNull); |
| 5720 expect(alias.isSynthetic, isFalse); | 5718 expect(alias.isSynthetic, isFalse); |
| 5721 List<VariableElement> parameters = alias.parameters; | 5719 List<VariableElement> parameters = alias.parameters; |
| 5722 expect(parameters, isNotNull); | 5720 expect(parameters, isNotNull); |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6414 unit.types = <ClassElement>[element]; | 6412 unit.types = <ClassElement>[element]; |
| 6415 return element.type; | 6413 return element.type; |
| 6416 } | 6414 } |
| 6417 | 6415 |
| 6418 void test_creation() { | 6416 void test_creation() { |
| 6419 GatheringErrorListener listener = new GatheringErrorListener(); | 6417 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6420 TestSource source = new TestSource(); | 6418 TestSource source = new TestSource(); |
| 6421 expect(new ErrorReporter(listener, source), isNotNull); | 6419 expect(new ErrorReporter(listener, source), isNotNull); |
| 6422 } | 6420 } |
| 6423 | 6421 |
| 6422 void test_reportErrorForElement_named() { |
| 6423 DartType type = createType("/test1.dart", "A"); |
| 6424 ClassElement element = type.element; |
| 6425 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6426 ErrorReporter reporter = new ErrorReporter(listener, element.source); |
| 6427 reporter.reportErrorForElement( |
| 6428 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
| 6429 element, ['A']); |
| 6430 AnalysisError error = listener.errors[0]; |
| 6431 expect(error.offset, element.nameOffset); |
| 6432 } |
| 6433 |
| 6434 void test_reportErrorForElement_unnamed() { |
| 6435 ImportElementImpl element = |
| 6436 ElementFactory.importFor(ElementFactory.library(null, ''), null); |
| 6437 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6438 ErrorReporter reporter = new ErrorReporter( |
| 6439 listener, new NonExistingSource("/test.dart", UriKind.FILE_URI)); |
| 6440 reporter.reportErrorForElement( |
| 6441 StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, |
| 6442 element, ['A']); |
| 6443 AnalysisError error = listener.errors[0]; |
| 6444 expect(error.offset, element.nameOffset); |
| 6445 } |
| 6446 |
| 6424 void test_reportTypeErrorForNode_differentNames() { | 6447 void test_reportTypeErrorForNode_differentNames() { |
| 6425 DartType firstType = createType("/test1.dart", "A"); | 6448 DartType firstType = createType("/test1.dart", "A"); |
| 6426 DartType secondType = createType("/test2.dart", "B"); | 6449 DartType secondType = createType("/test2.dart", "B"); |
| 6427 GatheringErrorListener listener = new GatheringErrorListener(); | 6450 GatheringErrorListener listener = new GatheringErrorListener(); |
| 6428 ErrorReporter reporter = | 6451 ErrorReporter reporter = |
| 6429 new ErrorReporter(listener, firstType.element.source); | 6452 new ErrorReporter(listener, firstType.element.source); |
| 6430 reporter.reportTypeErrorForNode( | 6453 reporter.reportTypeErrorForNode( |
| 6431 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, | 6454 StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, |
| 6432 AstFactory.identifier3("x"), [firstType, secondType]); | 6455 AstFactory.identifier3("x"), [firstType, secondType]); |
| 6433 AnalysisError error = listener.errors[0]; | 6456 AnalysisError error = listener.errors[0]; |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7387 ht.HtmlUnit htmlUnit = parse(""" | 7410 ht.HtmlUnit htmlUnit = parse(""" |
| 7388 <html> | 7411 <html> |
| 7389 <body> | 7412 <body> |
| 7390 <script type='application/dart'> | 7413 <script type='application/dart'> |
| 7391 $scriptBody | 7414 $scriptBody |
| 7392 </script> | 7415 </script> |
| 7393 </body> | 7416 </body> |
| 7394 </html>"""); | 7417 </html>"""); |
| 7395 _validate(htmlUnit, [ | 7418 _validate(htmlUnit, [ |
| 7396 _t4("html", [ | 7419 _t4("html", [ |
| 7397 _t4("body", [ | 7420 _t4("body", |
| 7398 _t("script", _a(["type", "'application/dart'"]), scriptBody) | 7421 [_t("script", _a(["type", "'application/dart'"]), scriptBody)]) |
| 7399 ]) | |
| 7400 ]) | 7422 ]) |
| 7401 ]); | 7423 ]); |
| 7402 } | 7424 } |
| 7403 ht.HtmlUnit parse(String contents) { | 7425 ht.HtmlUnit parse(String contents) { |
| 7404 // TestSource source = | 7426 // TestSource source = |
| 7405 // new TestSource.con1(FileUtilities2.createFile("/test.dart"), contents)
; | 7427 // new TestSource.con1(FileUtilities2.createFile("/test.dart"), contents)
; |
| 7406 ht.AbstractScanner scanner = new ht.StringScanner(null, contents); | 7428 ht.AbstractScanner scanner = new ht.StringScanner(null, contents); |
| 7407 scanner.passThroughElements = <String>[_TAG_SCRIPT]; | 7429 scanner.passThroughElements = <String>[_TAG_SCRIPT]; |
| 7408 ht.Token token = scanner.tokenize(); | 7430 ht.Token token = scanner.tokenize(); |
| 7409 LineInfo lineInfo = new LineInfo(scanner.lineStarts); | 7431 LineInfo lineInfo = new LineInfo(scanner.lineStarts); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7457 } | 7479 } |
| 7458 void test_parse_comment_in_content() { | 7480 void test_parse_comment_in_content() { |
| 7459 ht.HtmlUnit htmlUnit = parse("<html><!-- comment --></html>"); | 7481 ht.HtmlUnit htmlUnit = parse("<html><!-- comment --></html>"); |
| 7460 _validate(htmlUnit, [_t3("html", "<!-- comment -->")]); | 7482 _validate(htmlUnit, [_t3("html", "<!-- comment -->")]); |
| 7461 } | 7483 } |
| 7462 void test_parse_content() { | 7484 void test_parse_content() { |
| 7463 ht.HtmlUnit htmlUnit = parse("<html>\n<p a=\"b\">blat \n </p>\n</html>"); | 7485 ht.HtmlUnit htmlUnit = parse("<html>\n<p a=\"b\">blat \n </p>\n</html>"); |
| 7464 // ht.XmlTagNode.getContent() does not include whitespace | 7486 // ht.XmlTagNode.getContent() does not include whitespace |
| 7465 // between '<' and '>' at this time | 7487 // between '<' and '>' at this time |
| 7466 _validate(htmlUnit, [ | 7488 _validate(htmlUnit, [ |
| 7467 _t3("html", "\n<pa=\"b\">blat \n </p>\n", [ | 7489 _t3("html", "\n<pa=\"b\">blat \n </p>\n", |
| 7468 _t("p", _a(["a", "\"b\""]), "blat \n ") | 7490 [_t("p", _a(["a", "\"b\""]), "blat \n ")]) |
| 7469 ]) | |
| 7470 ]); | 7491 ]); |
| 7471 } | 7492 } |
| 7472 void test_parse_content_none() { | 7493 void test_parse_content_none() { |
| 7473 ht.HtmlUnit htmlUnit = parse("<html><p/>blat<p/></html>"); | 7494 ht.HtmlUnit htmlUnit = parse("<html><p/>blat<p/></html>"); |
| 7474 _validate( | 7495 _validate( |
| 7475 htmlUnit, [_t3("html", "<p/>blat<p/>", [_t3("p", ""), _t3("p", "")])]); | 7496 htmlUnit, [_t3("html", "<p/>blat<p/>", [_t3("p", ""), _t3("p", "")])]); |
| 7476 } | 7497 } |
| 7477 void test_parse_declaration() { | 7498 void test_parse_declaration() { |
| 7478 ht.HtmlUnit htmlUnit = parse("<!DOCTYPE html>\n\n<html><p></p></html>"); | 7499 ht.HtmlUnit htmlUnit = parse("<!DOCTYPE html>\n\n<html><p></p></html>"); |
| 7479 _validate(htmlUnit, [_t4("html", [_t3("p", "")])]); | 7500 _validate(htmlUnit, [_t4("html", [_t3("p", "")])]); |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8578 if (_expectedExternalScriptName == null) { | 8599 if (_expectedExternalScriptName == null) { |
| 8579 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 8600 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
| 8580 } else { | 8601 } else { |
| 8581 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 8602 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
| 8582 String actualExternalScriptName = scriptSource.shortName; | 8603 String actualExternalScriptName = scriptSource.shortName; |
| 8583 expect(actualExternalScriptName, _expectedExternalScriptName, | 8604 expect(actualExternalScriptName, _expectedExternalScriptName, |
| 8584 reason: "script $scriptIndex"); | 8605 reason: "script $scriptIndex"); |
| 8585 } | 8606 } |
| 8586 } | 8607 } |
| 8587 } | 8608 } |
| OLD | NEW |