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

Side by Side Diff: pkg/analyzer/test/generated/all_the_rest.dart

Issue 681003002: Replace ${name} with $name where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up also implementation Created 6 years, 1 month 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
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 // 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 if (lexeme.startsWith("<?")) { 364 if (lexeme.startsWith("<?")) {
365 return ht.TokenType.DIRECTIVE; 365 return ht.TokenType.DIRECTIVE;
366 } 366 }
367 if (_isTag(lexeme)) { 367 if (_isTag(lexeme)) {
368 return ht.TokenType.TAG; 368 return ht.TokenType.TAG;
369 } 369 }
370 return ht.TokenType.TEXT; 370 return ht.TokenType.TEXT;
371 } 371 }
372 JUnitTestCase.fail( 372 JUnitTestCase.fail(
373 "Unknown expected token ${count}: ${(expected != null ? expected.runtime Type : "null")}"); 373 "Unknown expected token $count: ${(expected != null ? expected.runtimeTy pe : "null")}");
374 return null; 374 return null;
375 } 375 }
376 376
377 bool _isTag(String lexeme) { 377 bool _isTag(String lexeme) {
378 if (lexeme.length == 0 || !Character.isLetter(lexeme.codeUnitAt(0))) { 378 if (lexeme.length == 0 || !Character.isLetter(lexeme.codeUnitAt(0))) {
379 return false; 379 return false;
380 } 380 }
381 for (int index = 1; index < lexeme.length; index++) { 381 for (int index = 1; index < lexeme.length; index++) {
382 int ch = lexeme.codeUnitAt(index); 382 int ch = lexeme.codeUnitAt(index);
383 if (!Character.isLetterOrDigit(ch) && ch != 0x2D && ch != 0x5F) { 383 if (!Character.isLetterOrDigit(ch) && ch != 0x2D && ch != 0x5F) {
(...skipping 18 matching lines...) Expand all
402 JUnitTestCase.assertEquals(-1, previousToken.offset); 402 JUnitTestCase.assertEquals(-1, previousToken.offset);
403 JUnitTestCase.assertSame(token, previousToken.next); 403 JUnitTestCase.assertSame(token, previousToken.next);
404 JUnitTestCase.assertEquals(0, token.offset); 404 JUnitTestCase.assertEquals(0, token.offset);
405 while (token.type != ht.TokenType.EOF) { 405 while (token.type != ht.TokenType.EOF) {
406 if (count == expectedTokens.length) { 406 if (count == expectedTokens.length) {
407 JUnitTestCase.fail("too many parsed tokens"); 407 JUnitTestCase.fail("too many parsed tokens");
408 } 408 }
409 Object expected = expectedTokens[count]; 409 Object expected = expectedTokens[count];
410 ht.TokenType expectedTokenType = _getExpectedTokenType(count, expected); 410 ht.TokenType expectedTokenType = _getExpectedTokenType(count, expected);
411 JUnitTestCase.assertSameMsg( 411 JUnitTestCase.assertSameMsg(
412 "token ${count}", 412 "token $count",
413 expectedTokenType, 413 expectedTokenType,
414 token.type); 414 token.type);
415 if (expectedTokenType.lexeme != null) { 415 if (expectedTokenType.lexeme != null) {
416 JUnitTestCase.assertEqualsMsg( 416 JUnitTestCase.assertEqualsMsg(
417 "token ${count}", 417 "token $count",
418 expectedTokenType.lexeme, 418 expectedTokenType.lexeme,
419 token.lexeme); 419 token.lexeme);
420 } else { 420 } else {
421 JUnitTestCase.assertEqualsMsg("token ${count}", expected, token.lexeme); 421 JUnitTestCase.assertEqualsMsg("token $count", expected, token.lexeme);
422 } 422 }
423 count++; 423 count++;
424 previousToken = token; 424 previousToken = token;
425 token = token.next; 425 token = token.next;
426 JUnitTestCase.assertSame(previousToken, token.previous); 426 JUnitTestCase.assertSame(previousToken, token.previous);
427 } 427 }
428 JUnitTestCase.assertSame(token, token.next); 428 JUnitTestCase.assertSame(token, token.next);
429 JUnitTestCase.assertEquals(input.length, token.offset); 429 JUnitTestCase.assertEquals(input.length, token.offset);
430 if (count != expectedTokens.length) { 430 if (count != expectedTokens.length) {
431 JUnitTestCase.assertTrueMsg("not enough parsed tokens", false); 431 JUnitTestCase.assertTrueMsg("not enough parsed tokens", false);
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2715 AstNode findExpression(int offset, Predicate<AstNode> predicate) { 2715 AstNode findExpression(int offset, Predicate<AstNode> predicate) {
2716 Expression expression = ht.HtmlUnitUtils.getExpression(indexUnit, offset); 2716 Expression expression = ht.HtmlUnitUtils.getExpression(indexUnit, offset);
2717 return expression != null ? expression.getAncestor(predicate) : null; 2717 return expression != null ? expression.getAncestor(predicate) : null;
2718 } 2718 }
2719 2719
2720 /** 2720 /**
2721 * Returns the [SimpleIdentifier] at the given search pattern. Fails if not fo und. 2721 * Returns the [SimpleIdentifier] at the given search pattern. Fails if not fo und.
2722 */ 2722 */
2723 SimpleIdentifier findIdentifier(String search) { 2723 SimpleIdentifier findIdentifier(String search) {
2724 SimpleIdentifier identifier = findIdentifierMaybe(search); 2724 SimpleIdentifier identifier = findIdentifierMaybe(search);
2725 JUnitTestCase.assertNotNullMsg("${search} in ${indexContent}", identifier); 2725 JUnitTestCase.assertNotNullMsg("$search in $indexContent", identifier);
2726 // check that offset/length of the identifier is valid 2726 // check that offset/length of the identifier is valid
2727 { 2727 {
2728 int offset = identifier.offset; 2728 int offset = identifier.offset;
2729 int end = identifier.end; 2729 int end = identifier.end;
2730 String contentStr = indexContent.substring(offset, end); 2730 String contentStr = indexContent.substring(offset, end);
2731 JUnitTestCase.assertEquals(identifier.name, contentStr); 2731 JUnitTestCase.assertEquals(identifier.name, contentStr);
2732 } 2732 }
2733 // done 2733 // done
2734 return identifier; 2734 return identifier;
2735 } 2735 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 EvaluationResult result = _getExpressionValue(contents); 3419 EvaluationResult result = _getExpressionValue(contents);
3420 DartObject value = result.value; 3420 DartObject value = result.value;
3421 JUnitTestCase.assertNotNull(value); 3421 JUnitTestCase.assertNotNull(value);
3422 ParameterizedType type = value.type; 3422 ParameterizedType type = value.type;
3423 JUnitTestCase.assertNotNull(type); 3423 JUnitTestCase.assertNotNull(type);
3424 JUnitTestCase.assertEquals("String", type.name); 3424 JUnitTestCase.assertEquals("String", type.name);
3425 JUnitTestCase.assertEquals(expectedValue, value.stringValue); 3425 JUnitTestCase.assertEquals(expectedValue, value.stringValue);
3426 } 3426 }
3427 3427
3428 EvaluationResult _getExpressionValue(String contents) { 3428 EvaluationResult _getExpressionValue(String contents) {
3429 Source source = addSource("var x = ${contents};"); 3429 Source source = addSource("var x = $contents;");
3430 LibraryElement library = resolve(source); 3430 LibraryElement library = resolve(source);
3431 CompilationUnit unit = 3431 CompilationUnit unit =
3432 analysisContext.resolveCompilationUnit(source, library); 3432 analysisContext.resolveCompilationUnit(source, library);
3433 JUnitTestCase.assertNotNull(unit); 3433 JUnitTestCase.assertNotNull(unit);
3434 NodeList<CompilationUnitMember> declarations = unit.declarations; 3434 NodeList<CompilationUnitMember> declarations = unit.declarations;
3435 EngineTestCase.assertSizeOfList(1, declarations); 3435 EngineTestCase.assertSizeOfList(1, declarations);
3436 CompilationUnitMember declaration = declarations[0]; 3436 CompilationUnitMember declaration = declarations[0];
3437 EngineTestCase.assertInstanceOf( 3437 EngineTestCase.assertInstanceOf(
3438 (obj) => obj is TopLevelVariableDeclaration, 3438 (obj) => obj is TopLevelVariableDeclaration,
3439 TopLevelVariableDeclaration, 3439 TopLevelVariableDeclaration,
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
4498 JUnitTestCase.assertNotNull(result.value); 4498 JUnitTestCase.assertNotNull(result.value);
4499 DartObjectImpl value = result.value; 4499 DartObjectImpl value = result.value;
4500 JUnitTestCase.assertTrue(value.isUnknown); 4500 JUnitTestCase.assertTrue(value.isUnknown);
4501 } 4501 }
4502 4502
4503 void _checkInstanceCreationOptionalParams(bool isFieldFormal, bool isNamed, 4503 void _checkInstanceCreationOptionalParams(bool isFieldFormal, bool isNamed,
4504 bool hasDefault) { 4504 bool hasDefault) {
4505 String fieldName = "j"; 4505 String fieldName = "j";
4506 String paramName = isFieldFormal ? fieldName : "i"; 4506 String paramName = isFieldFormal ? fieldName : "i";
4507 String formalParam = 4507 String formalParam =
4508 "${(isFieldFormal ? "this." : "int ")}${paramName}${(hasDefault ? " = 3" : "")}"; 4508 "${(isFieldFormal ? "this." : "int ")}$paramName${(hasDefault ? " = 3" : "")}";
4509 CompilationUnit compilationUnit = resolveSource(""" 4509 CompilationUnit compilationUnit = resolveSource("""
4510 const x = const A(); 4510 const x = const A();
4511 const y = const A(${isNamed ? '$paramName: ' : ''}10); 4511 const y = const A(${isNamed ? '$paramName: ' : ''}10);
4512 class A { 4512 class A {
4513 const A(${isNamed ? "{${formalParam}}" : "[${formalParam}]"})${isFieldFormal ? "" : " : ${fieldName} = ${paramName}"}; 4513 const A(${isNamed ? "{$formalParam}" : "[$formalParam]"})${isFieldFormal ? "" : " : $fieldName = $paramName"};
4514 final int ${fieldName}; 4514 final int $fieldName;
4515 }"""); 4515 }""");
4516 EvaluationResultImpl x = 4516 EvaluationResultImpl x =
4517 _evaluateInstanceCreationExpression(compilationUnit, "x"); 4517 _evaluateInstanceCreationExpression(compilationUnit, "x");
4518 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A"); 4518 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A");
4519 EngineTestCase.assertSizeOfMap(1, fieldsOfX); 4519 EngineTestCase.assertSizeOfMap(1, fieldsOfX);
4520 if (hasDefault) { 4520 if (hasDefault) {
4521 _assertIntField(fieldsOfX, fieldName, 3); 4521 _assertIntField(fieldsOfX, fieldName, 3);
4522 } else { 4522 } else {
4523 _assertNullField(fieldsOfX, fieldName); 4523 _assertNullField(fieldsOfX, fieldName);
4524 } 4524 }
4525 EvaluationResultImpl y = 4525 EvaluationResultImpl y =
4526 _evaluateInstanceCreationExpression(compilationUnit, "y"); 4526 _evaluateInstanceCreationExpression(compilationUnit, "y");
4527 Map<String, DartObjectImpl> fieldsOfY = _assertType(y, "A"); 4527 Map<String, DartObjectImpl> fieldsOfY = _assertType(y, "A");
4528 EngineTestCase.assertSizeOfMap(1, fieldsOfY); 4528 EngineTestCase.assertSizeOfMap(1, fieldsOfY);
4529 _assertIntField(fieldsOfY, fieldName, 10); 4529 _assertIntField(fieldsOfY, fieldName, 10);
4530 } 4530 }
4531 4531
4532 void _checkInstanceCreation_withSupertypeParams(bool isExplicit) { 4532 void _checkInstanceCreation_withSupertypeParams(bool isExplicit) {
4533 String superCall = isExplicit ? " : super()" : ""; 4533 String superCall = isExplicit ? " : super()" : "";
4534 CompilationUnit compilationUnit = resolveSource(""" 4534 CompilationUnit compilationUnit = resolveSource("""
4535 class A<T> { 4535 class A<T> {
4536 const A(); 4536 const A();
4537 } 4537 }
4538 class B<T, U> extends A<T> { 4538 class B<T, U> extends A<T> {
4539 const B()$superCall; 4539 const B()$superCall;
4540 } 4540 }
4541 class C<T, U> extends A<U> { 4541 class C<T, U> extends A<U> {
4542 const C()${superCall}; 4542 const C()$superCall;
4543 } 4543 }
4544 const b_int_num = const B<int, num>(); 4544 const b_int_num = const B<int, num>();
4545 const c_int_num = const C<int, num>();"""); 4545 const c_int_num = const C<int, num>();""");
4546 EvaluationResultImpl b_int_num = 4546 EvaluationResultImpl b_int_num =
4547 _evaluateInstanceCreationExpression(compilationUnit, "b_int_num"); 4547 _evaluateInstanceCreationExpression(compilationUnit, "b_int_num");
4548 Map<String, DartObjectImpl> b_int_num_fields = 4548 Map<String, DartObjectImpl> b_int_num_fields =
4549 _assertType(b_int_num, "B<int, num>"); 4549 _assertType(b_int_num, "B<int, num>");
4550 _assertFieldType(b_int_num_fields, GenericState.SUPERCLASS_FIELD, "A<int>"); 4550 _assertFieldType(b_int_num_fields, GenericState.SUPERCLASS_FIELD, "A<int>");
4551 EvaluationResultImpl c_int_num = 4551 EvaluationResultImpl c_int_num =
4552 _evaluateInstanceCreationExpression(compilationUnit, "c_int_num"); 4552 _evaluateInstanceCreationExpression(compilationUnit, "c_int_num");
4553 Map<String, DartObjectImpl> c_int_num_fields = 4553 Map<String, DartObjectImpl> c_int_num_fields =
4554 _assertType(c_int_num, "C<int, num>"); 4554 _assertType(c_int_num, "C<int, num>");
4555 _assertFieldType(c_int_num_fields, GenericState.SUPERCLASS_FIELD, "A<num>"); 4555 _assertFieldType(c_int_num_fields, GenericState.SUPERCLASS_FIELD, "A<num>");
4556 } 4556 }
4557 4557
4558 EvaluationResultImpl _check_fromEnvironment_bool(String valueInEnvironment, 4558 EvaluationResultImpl _check_fromEnvironment_bool(String valueInEnvironment,
4559 String defaultExpr) { 4559 String defaultExpr) {
4560 String envVarName = "x"; 4560 String envVarName = "x";
4561 String varName = "foo"; 4561 String varName = "foo";
4562 if (valueInEnvironment != null) { 4562 if (valueInEnvironment != null) {
4563 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment); 4563 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
4564 } 4564 }
4565 String defaultArg = 4565 String defaultArg =
4566 defaultExpr == null ? "" : ", defaultValue: ${defaultExpr}"; 4566 defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
4567 CompilationUnit compilationUnit = resolveSource( 4567 CompilationUnit compilationUnit = resolveSource(
4568 "const ${varName} = const bool.fromEnvironment('${envVarName}'${ defaultArg});"); 4568 "const $varName = const bool.fromEnvironment('$envVarName'$defau ltArg);");
4569 return _evaluateInstanceCreationExpression(compilationUnit, varName); 4569 return _evaluateInstanceCreationExpression(compilationUnit, varName);
4570 } 4570 }
4571 4571
4572 EvaluationResultImpl _check_fromEnvironment_int(String valueInEnvironment, 4572 EvaluationResultImpl _check_fromEnvironment_int(String valueInEnvironment,
4573 String defaultExpr) { 4573 String defaultExpr) {
4574 String envVarName = "x"; 4574 String envVarName = "x";
4575 String varName = "foo"; 4575 String varName = "foo";
4576 if (valueInEnvironment != null) { 4576 if (valueInEnvironment != null) {
4577 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment); 4577 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
4578 } 4578 }
4579 String defaultArg = 4579 String defaultArg =
4580 defaultExpr == null ? "" : ", defaultValue: ${defaultExpr}"; 4580 defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
4581 CompilationUnit compilationUnit = resolveSource( 4581 CompilationUnit compilationUnit = resolveSource(
4582 "const ${varName} = const int.fromEnvironment('${envVarName}'${d efaultArg});"); 4582 "const $varName = const int.fromEnvironment('$envVarName'$defaul tArg);");
4583 return _evaluateInstanceCreationExpression(compilationUnit, varName); 4583 return _evaluateInstanceCreationExpression(compilationUnit, varName);
4584 } 4584 }
4585 4585
4586 EvaluationResultImpl _check_fromEnvironment_string(String valueInEnvironment, 4586 EvaluationResultImpl _check_fromEnvironment_string(String valueInEnvironment,
4587 String defaultExpr) { 4587 String defaultExpr) {
4588 String envVarName = "x"; 4588 String envVarName = "x";
4589 String varName = "foo"; 4589 String varName = "foo";
4590 if (valueInEnvironment != null) { 4590 if (valueInEnvironment != null) {
4591 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment); 4591 analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
4592 } 4592 }
4593 String defaultArg = 4593 String defaultArg =
4594 defaultExpr == null ? "" : ", defaultValue: ${defaultExpr}"; 4594 defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
4595 CompilationUnit compilationUnit = resolveSource( 4595 CompilationUnit compilationUnit = resolveSource(
4596 "const ${varName} = const String.fromEnvironment('${envVarName}' ${defaultArg});"); 4596 "const $varName = const String.fromEnvironment('$envVarName'$def aultArg);");
4597 return _evaluateInstanceCreationExpression(compilationUnit, varName); 4597 return _evaluateInstanceCreationExpression(compilationUnit, varName);
4598 } 4598 }
4599 4599
4600 EvaluationResultImpl 4600 EvaluationResultImpl
4601 _evaluateInstanceCreationExpression(CompilationUnit compilationUnit, 4601 _evaluateInstanceCreationExpression(CompilationUnit compilationUnit,
4602 String name) { 4602 String name) {
4603 Expression expression = 4603 Expression expression =
4604 findTopLevelConstantExpression(compilationUnit, name); 4604 findTopLevelConstantExpression(compilationUnit, name);
4605 return (expression as InstanceCreationExpression).evaluationResult; 4605 return (expression as InstanceCreationExpression).evaluationResult;
4606 } 4606 }
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
7683 Keyword.SET, 7683 Keyword.SET,
7684 functionName, 7684 functionName,
7685 AstFactory.functionExpression2( 7685 AstFactory.functionExpression2(
7686 AstFactory.formalParameterList([]), 7686 AstFactory.formalParameterList([]),
7687 AstFactory.blockFunctionBody2([]))); 7687 AstFactory.blockFunctionBody2([])));
7688 declaration.accept(builder); 7688 declaration.accept(builder);
7689 List<PropertyAccessorElement> accessors = holder.accessors; 7689 List<PropertyAccessorElement> accessors = holder.accessors;
7690 EngineTestCase.assertLength(1, accessors); 7690 EngineTestCase.assertLength(1, accessors);
7691 PropertyAccessorElement accessor = accessors[0]; 7691 PropertyAccessorElement accessor = accessors[0];
7692 JUnitTestCase.assertNotNull(accessor); 7692 JUnitTestCase.assertNotNull(accessor);
7693 JUnitTestCase.assertEquals("${functionName}=", accessor.name); 7693 JUnitTestCase.assertEquals("$functionName=", accessor.name);
7694 JUnitTestCase.assertSame(accessor, declaration.element); 7694 JUnitTestCase.assertSame(accessor, declaration.element);
7695 JUnitTestCase.assertSame(accessor, declaration.functionExpression.element); 7695 JUnitTestCase.assertSame(accessor, declaration.functionExpression.element);
7696 JUnitTestCase.assertFalse(accessor.isGetter); 7696 JUnitTestCase.assertFalse(accessor.isGetter);
7697 JUnitTestCase.assertTrue(accessor.isSetter); 7697 JUnitTestCase.assertTrue(accessor.isSetter);
7698 JUnitTestCase.assertFalse(accessor.isSynthetic); 7698 JUnitTestCase.assertFalse(accessor.isSynthetic);
7699 PropertyInducingElement variable = accessor.variable; 7699 PropertyInducingElement variable = accessor.variable;
7700 EngineTestCase.assertInstanceOf( 7700 EngineTestCase.assertInstanceOf(
7701 (obj) => obj is TopLevelVariableElement, 7701 (obj) => obj is TopLevelVariableElement,
7702 TopLevelVariableElement, 7702 TopLevelVariableElement,
7703 variable); 7703 variable);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
7981 FieldElement field = fields[0]; 7981 FieldElement field = fields[0];
7982 JUnitTestCase.assertNotNull(field); 7982 JUnitTestCase.assertNotNull(field);
7983 JUnitTestCase.assertEquals(methodName, field.name); 7983 JUnitTestCase.assertEquals(methodName, field.name);
7984 JUnitTestCase.assertTrue(field.isSynthetic); 7984 JUnitTestCase.assertTrue(field.isSynthetic);
7985 JUnitTestCase.assertNull(field.getter); 7985 JUnitTestCase.assertNull(field.getter);
7986 PropertyAccessorElement setter = field.setter; 7986 PropertyAccessorElement setter = field.setter;
7987 JUnitTestCase.assertNotNull(setter); 7987 JUnitTestCase.assertNotNull(setter);
7988 JUnitTestCase.assertFalse(setter.isAbstract); 7988 JUnitTestCase.assertFalse(setter.isAbstract);
7989 JUnitTestCase.assertTrue(setter.isSetter); 7989 JUnitTestCase.assertTrue(setter.isSetter);
7990 JUnitTestCase.assertFalse(setter.isSynthetic); 7990 JUnitTestCase.assertFalse(setter.isSynthetic);
7991 JUnitTestCase.assertEquals("${methodName}=", setter.name); 7991 JUnitTestCase.assertEquals("$methodName=", setter.name);
7992 JUnitTestCase.assertEquals(methodName, setter.displayName); 7992 JUnitTestCase.assertEquals(methodName, setter.displayName);
7993 JUnitTestCase.assertEquals(field, setter.variable); 7993 JUnitTestCase.assertEquals(field, setter.variable);
7994 EngineTestCase.assertLength(0, setter.functions); 7994 EngineTestCase.assertLength(0, setter.functions);
7995 EngineTestCase.assertLength(0, setter.labels); 7995 EngineTestCase.assertLength(0, setter.labels);
7996 EngineTestCase.assertLength(0, setter.localVariables); 7996 EngineTestCase.assertLength(0, setter.localVariables);
7997 EngineTestCase.assertLength(0, setter.parameters); 7997 EngineTestCase.assertLength(0, setter.parameters);
7998 } 7998 }
7999 7999
8000 void test_visitMethodDeclaration_setter_abstract() { 8000 void test_visitMethodDeclaration_setter_abstract() {
8001 ElementHolder holder = new ElementHolder(); 8001 ElementHolder holder = new ElementHolder();
(...skipping 13 matching lines...) Expand all
8015 FieldElement field = fields[0]; 8015 FieldElement field = fields[0];
8016 JUnitTestCase.assertNotNull(field); 8016 JUnitTestCase.assertNotNull(field);
8017 JUnitTestCase.assertEquals(methodName, field.name); 8017 JUnitTestCase.assertEquals(methodName, field.name);
8018 JUnitTestCase.assertTrue(field.isSynthetic); 8018 JUnitTestCase.assertTrue(field.isSynthetic);
8019 JUnitTestCase.assertNull(field.getter); 8019 JUnitTestCase.assertNull(field.getter);
8020 PropertyAccessorElement setter = field.setter; 8020 PropertyAccessorElement setter = field.setter;
8021 JUnitTestCase.assertNotNull(setter); 8021 JUnitTestCase.assertNotNull(setter);
8022 JUnitTestCase.assertTrue(setter.isAbstract); 8022 JUnitTestCase.assertTrue(setter.isAbstract);
8023 JUnitTestCase.assertTrue(setter.isSetter); 8023 JUnitTestCase.assertTrue(setter.isSetter);
8024 JUnitTestCase.assertFalse(setter.isSynthetic); 8024 JUnitTestCase.assertFalse(setter.isSynthetic);
8025 JUnitTestCase.assertEquals("${methodName}=", setter.name); 8025 JUnitTestCase.assertEquals("$methodName=", setter.name);
8026 JUnitTestCase.assertEquals(methodName, setter.displayName); 8026 JUnitTestCase.assertEquals(methodName, setter.displayName);
8027 JUnitTestCase.assertEquals(field, setter.variable); 8027 JUnitTestCase.assertEquals(field, setter.variable);
8028 EngineTestCase.assertLength(0, setter.functions); 8028 EngineTestCase.assertLength(0, setter.functions);
8029 EngineTestCase.assertLength(0, setter.labels); 8029 EngineTestCase.assertLength(0, setter.labels);
8030 EngineTestCase.assertLength(0, setter.localVariables); 8030 EngineTestCase.assertLength(0, setter.localVariables);
8031 EngineTestCase.assertLength(0, setter.parameters); 8031 EngineTestCase.assertLength(0, setter.parameters);
8032 } 8032 }
8033 8033
8034 void test_visitMethodDeclaration_setter_external() { 8034 void test_visitMethodDeclaration_setter_external() {
8035 ElementHolder holder = new ElementHolder(); 8035 ElementHolder holder = new ElementHolder();
(...skipping 12 matching lines...) Expand all
8048 FieldElement field = fields[0]; 8048 FieldElement field = fields[0];
8049 JUnitTestCase.assertNotNull(field); 8049 JUnitTestCase.assertNotNull(field);
8050 JUnitTestCase.assertEquals(methodName, field.name); 8050 JUnitTestCase.assertEquals(methodName, field.name);
8051 JUnitTestCase.assertTrue(field.isSynthetic); 8051 JUnitTestCase.assertTrue(field.isSynthetic);
8052 JUnitTestCase.assertNull(field.getter); 8052 JUnitTestCase.assertNull(field.getter);
8053 PropertyAccessorElement setter = field.setter; 8053 PropertyAccessorElement setter = field.setter;
8054 JUnitTestCase.assertNotNull(setter); 8054 JUnitTestCase.assertNotNull(setter);
8055 JUnitTestCase.assertFalse(setter.isAbstract); 8055 JUnitTestCase.assertFalse(setter.isAbstract);
8056 JUnitTestCase.assertTrue(setter.isSetter); 8056 JUnitTestCase.assertTrue(setter.isSetter);
8057 JUnitTestCase.assertFalse(setter.isSynthetic); 8057 JUnitTestCase.assertFalse(setter.isSynthetic);
8058 JUnitTestCase.assertEquals("${methodName}=", setter.name); 8058 JUnitTestCase.assertEquals("$methodName=", setter.name);
8059 JUnitTestCase.assertEquals(methodName, setter.displayName); 8059 JUnitTestCase.assertEquals(methodName, setter.displayName);
8060 JUnitTestCase.assertEquals(field, setter.variable); 8060 JUnitTestCase.assertEquals(field, setter.variable);
8061 EngineTestCase.assertLength(0, setter.functions); 8061 EngineTestCase.assertLength(0, setter.functions);
8062 EngineTestCase.assertLength(0, setter.labels); 8062 EngineTestCase.assertLength(0, setter.labels);
8063 EngineTestCase.assertLength(0, setter.localVariables); 8063 EngineTestCase.assertLength(0, setter.localVariables);
8064 EngineTestCase.assertLength(0, setter.parameters); 8064 EngineTestCase.assertLength(0, setter.parameters);
8065 } 8065 }
8066 8066
8067 void test_visitMethodDeclaration_static() { 8067 void test_visitMethodDeclaration_static() {
8068 ElementHolder holder = new ElementHolder(); 8068 ElementHolder holder = new ElementHolder();
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
10136 } 10136 }
10137 10137
10138 10138
10139 class HtmlUnitBuilderTest_ExpectedLibrary { 10139 class HtmlUnitBuilderTest_ExpectedLibrary {
10140 final HtmlUnitBuilderTest HtmlUnitBuilderTest_this; 10140 final HtmlUnitBuilderTest HtmlUnitBuilderTest_this;
10141 final List<HtmlUnitBuilderTest_ExpectedVariable> _expectedVariables; 10141 final List<HtmlUnitBuilderTest_ExpectedVariable> _expectedVariables;
10142 HtmlUnitBuilderTest_ExpectedLibrary(this.HtmlUnitBuilderTest_this, 10142 HtmlUnitBuilderTest_ExpectedLibrary(this.HtmlUnitBuilderTest_this,
10143 this._expectedVariables); 10143 this._expectedVariables);
10144 void _validate(int scriptIndex, EmbeddedHtmlScriptElementImpl script) { 10144 void _validate(int scriptIndex, EmbeddedHtmlScriptElementImpl script) {
10145 LibraryElement library = script.scriptLibrary; 10145 LibraryElement library = script.scriptLibrary;
10146 JUnitTestCase.assertNotNullMsg("script ${scriptIndex}", library); 10146 JUnitTestCase.assertNotNullMsg("script $scriptIndex", library);
10147 JUnitTestCase.assertSameMsg( 10147 JUnitTestCase.assertSameMsg(
10148 "script ${scriptIndex}", 10148 "script $scriptIndex",
10149 HtmlUnitBuilderTest_this._context, 10149 HtmlUnitBuilderTest_this._context,
10150 script.context); 10150 script.context);
10151 CompilationUnitElement unit = library.definingCompilationUnit; 10151 CompilationUnitElement unit = library.definingCompilationUnit;
10152 JUnitTestCase.assertNotNullMsg("script ${scriptIndex}", unit); 10152 JUnitTestCase.assertNotNullMsg("script $scriptIndex", unit);
10153 List<TopLevelVariableElement> variables = unit.topLevelVariables; 10153 List<TopLevelVariableElement> variables = unit.topLevelVariables;
10154 EngineTestCase.assertLength(_expectedVariables.length, variables); 10154 EngineTestCase.assertLength(_expectedVariables.length, variables);
10155 for (int index = 0; index < variables.length; index++) { 10155 for (int index = 0; index < variables.length; index++) {
10156 _expectedVariables[index].validate(scriptIndex, variables[index]); 10156 _expectedVariables[index].validate(scriptIndex, variables[index]);
10157 } 10157 }
10158 JUnitTestCase.assertSameMsg( 10158 JUnitTestCase.assertSameMsg(
10159 "script ${scriptIndex}", 10159 "script $scriptIndex",
10160 script, 10160 script,
10161 library.enclosingElement); 10161 library.enclosingElement);
10162 } 10162 }
10163 } 10163 }
10164 10164
10165 10165
10166 class HtmlUnitBuilderTest_ExpectedVariable { 10166 class HtmlUnitBuilderTest_ExpectedVariable {
10167 final String _expectedName; 10167 final String _expectedName;
10168 HtmlUnitBuilderTest_ExpectedVariable(this._expectedName); 10168 HtmlUnitBuilderTest_ExpectedVariable(this._expectedName);
10169 void validate(int scriptIndex, TopLevelVariableElement variable) { 10169 void validate(int scriptIndex, TopLevelVariableElement variable) {
10170 JUnitTestCase.assertNotNullMsg("script ${scriptIndex}", variable); 10170 JUnitTestCase.assertNotNullMsg("script $scriptIndex", variable);
10171 JUnitTestCase.assertEqualsMsg( 10171 JUnitTestCase.assertEqualsMsg(
10172 "script ${scriptIndex}", 10172 "script $scriptIndex",
10173 _expectedName, 10173 _expectedName,
10174 variable.name); 10174 variable.name);
10175 } 10175 }
10176 } 10176 }
10177 10177
10178 10178
10179 /** 10179 /**
10180 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes. 10180 * Instances of the class `HtmlWarningCodeTest` test the generation of HTML warn ing codes.
10181 */ 10181 */
10182 class HtmlWarningCodeTest extends EngineTestCase { 10182 class HtmlWarningCodeTest extends EngineTestCase {
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
10843 */ 10843 */
10844 int _expectedAttributeIndex = 0; 10844 int _expectedAttributeIndex = 0;
10845 /** 10845 /**
10846 * Assert that no errors were found while traversing any of the AST structures that have been 10846 * Assert that no errors were found while traversing any of the AST structures that have been
10847 * visited. 10847 * visited.
10848 */ 10848 */
10849 void assertValid() { 10849 void assertValid() {
10850 while (_expectedTagsIndex < _expectedTagsInOrderVisited.length) { 10850 while (_expectedTagsIndex < _expectedTagsInOrderVisited.length) {
10851 String expectedTag = 10851 String expectedTag =
10852 _expectedTagsInOrderVisited[_expectedTagsIndex++]._tag; 10852 _expectedTagsInOrderVisited[_expectedTagsIndex++]._tag;
10853 _errors.add("Expected to visit node with tag: ${expectedTag}"); 10853 _errors.add("Expected to visit node with tag: $expectedTag");
10854 } 10854 }
10855 if (!_errors.isEmpty) { 10855 if (!_errors.isEmpty) {
10856 StringBuffer buffer = new StringBuffer(); 10856 StringBuffer buffer = new StringBuffer();
10857 buffer.write("Invalid XML structure:"); 10857 buffer.write("Invalid XML structure:");
10858 for (String message in _errors) { 10858 for (String message in _errors) {
10859 buffer.writeln(); 10859 buffer.writeln();
10860 buffer.write(" "); 10860 buffer.write(" ");
10861 buffer.write(message); 10861 buffer.write(message);
10862 } 10862 }
10863 JUnitTestCase.fail(buffer.toString()); 10863 JUnitTestCase.fail(buffer.toString());
(...skipping 27 matching lines...) Expand all
10891 _errors.add( 10891 _errors.add(
10892 "Expected ${actual.runtimeType} to have parent of type XmlTagNode"); 10892 "Expected ${actual.runtimeType} to have parent of type XmlTagNode");
10893 } 10893 }
10894 String actualName = actual.name; 10894 String actualName = actual.name;
10895 String actualValue = actual.valueToken.lexeme; 10895 String actualValue = actual.valueToken.lexeme;
10896 if (_expectedAttributeIndex < _expectedAttributeKeyValuePairs.length) { 10896 if (_expectedAttributeIndex < _expectedAttributeKeyValuePairs.length) {
10897 String expectedName = 10897 String expectedName =
10898 _expectedAttributeKeyValuePairs[_expectedAttributeIndex]; 10898 _expectedAttributeKeyValuePairs[_expectedAttributeIndex];
10899 if (expectedName != actualName) { 10899 if (expectedName != actualName) {
10900 _errors.add( 10900 _errors.add(
10901 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have name: ${expectedName} but found: ${actualName}"); 10901 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have name: $expectedName but found: $actualName");
10902 } 10902 }
10903 String expectedValue = 10903 String expectedValue =
10904 _expectedAttributeKeyValuePairs[_expectedAttributeIndex + 1]; 10904 _expectedAttributeKeyValuePairs[_expectedAttributeIndex + 1];
10905 if (expectedValue != actualValue) { 10905 if (expectedValue != actualValue) {
10906 _errors.add( 10906 _errors.add(
10907 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have value: ${expectedValue} but found: ${actualValue}"); 10907 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have value: $expectedValue but found: $actualValue");
10908 } 10908 }
10909 } else { 10909 } else {
10910 _errors.add( 10910 _errors.add(
10911 "Unexpected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} n ame: ${actualName} value: ${actualValue}"); 10911 "Unexpected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} n ame: $actualName value: $actualValue");
10912 } 10912 }
10913 _expectedAttributeIndex += 2; 10913 _expectedAttributeIndex += 2;
10914 _validateNode(actual); 10914 _validateNode(actual);
10915 return super.visitXmlAttributeNode(actual); 10915 return super.visitXmlAttributeNode(actual);
10916 } 10916 }
10917 @override 10917 @override
10918 Object visitXmlTagNode(ht.XmlTagNode actual) { 10918 Object visitXmlTagNode(ht.XmlTagNode actual) {
10919 if (!(actual.parent is ht.HtmlUnit || actual.parent is ht.XmlTagNode)) { 10919 if (!(actual.parent is ht.HtmlUnit || actual.parent is ht.XmlTagNode)) {
10920 _errors.add( 10920 _errors.add(
10921 "Expected ${actual.runtimeType} to have parent of type HtmlUnit or Xml TagNode"); 10921 "Expected ${actual.runtimeType} to have parent of type HtmlUnit or Xml TagNode");
10922 } 10922 }
10923 if (_expectedTagsInOrderVisited != null) { 10923 if (_expectedTagsInOrderVisited != null) {
10924 String actualTag = actual.tag; 10924 String actualTag = actual.tag;
10925 if (_expectedTagsIndex < _expectedTagsInOrderVisited.length) { 10925 if (_expectedTagsIndex < _expectedTagsInOrderVisited.length) {
10926 XmlValidator_Tag expected = 10926 XmlValidator_Tag expected =
10927 _expectedTagsInOrderVisited[_expectedTagsIndex]; 10927 _expectedTagsInOrderVisited[_expectedTagsIndex];
10928 if (expected._tag != actualTag) { 10928 if (expected._tag != actualTag) {
10929 _errors.add( 10929 _errors.add(
10930 "Expected ${_expectedTagsIndex} tag: ${expected._tag} but found: $ {actualTag}"); 10930 "Expected $_expectedTagsIndex tag: ${expected._tag} but found: $ac tualTag");
10931 } 10931 }
10932 _expectedAttributeKeyValuePairs = expected._attributes._keyValuePairs; 10932 _expectedAttributeKeyValuePairs = expected._attributes._keyValuePairs;
10933 int expectedAttributeCount = 10933 int expectedAttributeCount =
10934 _expectedAttributeKeyValuePairs.length ~/ 10934 _expectedAttributeKeyValuePairs.length ~/
10935 2; 10935 2;
10936 int actualAttributeCount = actual.attributes.length; 10936 int actualAttributeCount = actual.attributes.length;
10937 if (expectedAttributeCount != actualAttributeCount) { 10937 if (expectedAttributeCount != actualAttributeCount) {
10938 _errors.add( 10938 _errors.add(
10939 "Expected ${_expectedTagsIndex} tag: ${expected._tag} to have ${ex pectedAttributeCount} attributes but found ${actualAttributeCount}"); 10939 "Expected $_expectedTagsIndex tag: ${expected._tag} to have $expec tedAttributeCount attributes but found $actualAttributeCount");
10940 } 10940 }
10941 _expectedAttributeIndex = 0; 10941 _expectedAttributeIndex = 0;
10942 _expectedTagsIndex++; 10942 _expectedTagsIndex++;
10943 JUnitTestCase.assertNotNull(actual.attributeEnd); 10943 JUnitTestCase.assertNotNull(actual.attributeEnd);
10944 JUnitTestCase.assertNotNull(actual.contentEnd); 10944 JUnitTestCase.assertNotNull(actual.contentEnd);
10945 int count = 0; 10945 int count = 0;
10946 ht.Token token = actual.attributeEnd.next; 10946 ht.Token token = actual.attributeEnd.next;
10947 ht.Token lastToken = actual.contentEnd; 10947 ht.Token lastToken = actual.contentEnd;
10948 while (!identical(token, lastToken)) { 10948 while (!identical(token, lastToken)) {
10949 token = token.next; 10949 token = token.next;
10950 if (++count > 1000) { 10950 if (++count > 1000) {
10951 JUnitTestCase.fail( 10951 JUnitTestCase.fail(
10952 "Expected ${_expectedTagsIndex} tag: ${expected._tag} to have a sequence of tokens from getAttributeEnd() to getContentEnd()"); 10952 "Expected $_expectedTagsIndex tag: ${expected._tag} to have a se quence of tokens from getAttributeEnd() to getContentEnd()");
10953 break; 10953 break;
10954 } 10954 }
10955 } 10955 }
10956 if (actual.attributeEnd.type == ht.TokenType.GT) { 10956 if (actual.attributeEnd.type == ht.TokenType.GT) {
10957 if (ht.HtmlParser.SELF_CLOSING.contains(actual.tag)) { 10957 if (ht.HtmlParser.SELF_CLOSING.contains(actual.tag)) {
10958 JUnitTestCase.assertNull(actual.closingTag); 10958 JUnitTestCase.assertNull(actual.closingTag);
10959 } else { 10959 } else {
10960 JUnitTestCase.assertNotNull(actual.closingTag); 10960 JUnitTestCase.assertNotNull(actual.closingTag);
10961 } 10961 }
10962 } else if (actual.attributeEnd.type == ht.TokenType.SLASH_GT) { 10962 } else if (actual.attributeEnd.type == ht.TokenType.SLASH_GT) {
10963 JUnitTestCase.assertNull(actual.closingTag); 10963 JUnitTestCase.assertNull(actual.closingTag);
10964 } else { 10964 } else {
10965 JUnitTestCase.fail( 10965 JUnitTestCase.fail(
10966 "Unexpected attribute end token: ${actual.attributeEnd.lexeme}"); 10966 "Unexpected attribute end token: ${actual.attributeEnd.lexeme}");
10967 } 10967 }
10968 if (expected._content != null && expected._content != actual.content) { 10968 if (expected._content != null && expected._content != actual.content) {
10969 _errors.add( 10969 _errors.add(
10970 "Expected ${_expectedTagsIndex} tag: ${expected._tag} to have cont ent '${expected._content}' but found '${actual.content}'"); 10970 "Expected $_expectedTagsIndex tag: ${expected._tag} to have conten t '${expected._content}' but found '${actual.content}'");
10971 } 10971 }
10972 if (expected._children.length != actual.tagNodes.length) { 10972 if (expected._children.length != actual.tagNodes.length) {
10973 _errors.add( 10973 _errors.add(
10974 "Expected ${_expectedTagsIndex} tag: ${expected._tag} to have ${ex pected._children.length} children but found ${actual.tagNodes.length}"); 10974 "Expected $_expectedTagsIndex tag: ${expected._tag} to have ${expe cted._children.length} children but found ${actual.tagNodes.length}");
10975 } else { 10975 } else {
10976 for (int index = 0; index < expected._children.length; index++) { 10976 for (int index = 0; index < expected._children.length; index++) {
10977 String expectedChildTag = expected._children[index]._tag; 10977 String expectedChildTag = expected._children[index]._tag;
10978 String actualChildTag = actual.tagNodes[index].tag; 10978 String actualChildTag = actual.tagNodes[index].tag;
10979 if (expectedChildTag != actualChildTag) { 10979 if (expectedChildTag != actualChildTag) {
10980 _errors.add( 10980 _errors.add(
10981 "Expected ${_expectedTagsIndex} tag: ${expected._tag} child ${ index} to have tag: ${expectedChildTag} but found: ${actualChildTag}"); 10981 "Expected $_expectedTagsIndex tag: ${expected._tag} child $ind ex to have tag: $expectedChildTag but found: $actualChildTag");
10982 } 10982 }
10983 } 10983 }
10984 } 10984 }
10985 } else { 10985 } else {
10986 _errors.add("Visited unexpected tag: ${actualTag}"); 10986 _errors.add("Visited unexpected tag: $actualTag");
10987 } 10987 }
10988 } 10988 }
10989 _validateNode(actual); 10989 _validateNode(actual);
10990 return super.visitXmlTagNode(actual); 10990 return super.visitXmlTagNode(actual);
10991 } 10991 }
10992 /** 10992 /**
10993 * Append the specified tags to the array in depth first order 10993 * Append the specified tags to the array in depth first order
10994 * 10994 *
10995 * @param expected the array to which the tags are added (not `null`) 10995 * @param expected the array to which the tags are added (not `null`)
10996 * @param expectedTags the expected tags to be added (not `null`, contains no `null`s) 10996 * @param expectedTags the expected tags to be added (not `null`, contains no `null`s)
(...skipping 17 matching lines...) Expand all
11014 if (nodeStart < 0 || nodeLength < 0) { 11014 if (nodeStart < 0 || nodeLength < 0) {
11015 _errors.add("No source info for ${node.runtimeType}"); 11015 _errors.add("No source info for ${node.runtimeType}");
11016 } 11016 }
11017 ht.XmlNode parent = node.parent; 11017 ht.XmlNode parent = node.parent;
11018 if (parent != null) { 11018 if (parent != null) {
11019 int nodeEnd = nodeStart + nodeLength; 11019 int nodeEnd = nodeStart + nodeLength;
11020 int parentStart = parent.offset; 11020 int parentStart = parent.offset;
11021 int parentEnd = parentStart + parent.length; 11021 int parentEnd = parentStart + parent.length;
11022 if (nodeStart < parentStart) { 11022 if (nodeStart < parentStart) {
11023 _errors.add( 11023 _errors.add(
11024 "Invalid source start (${nodeStart}) for ${node.runtimeType} inside ${parent.runtimeType} (${parentStart})"); 11024 "Invalid source start ($nodeStart) for ${node.runtimeType} inside ${ parent.runtimeType} ($parentStart)");
11025 } 11025 }
11026 if (nodeEnd > parentEnd) { 11026 if (nodeEnd > parentEnd) {
11027 _errors.add( 11027 _errors.add(
11028 "Invalid source end (${nodeEnd}) for ${node.runtimeType} inside ${pa rent.runtimeType} (${parentStart})"); 11028 "Invalid source end ($nodeEnd) for ${node.runtimeType} inside ${pare nt.runtimeType} ($parentStart)");
11029 } 11029 }
11030 } 11030 }
11031 } 11031 }
11032 } 11032 }
11033 11033
11034 11034
11035 class XmlValidator_Attributes { 11035 class XmlValidator_Attributes {
11036 final List<String> _keyValuePairs; 11036 final List<String> _keyValuePairs;
11037 XmlValidator_Attributes(this._keyValuePairs); 11037 XmlValidator_Attributes(this._keyValuePairs);
11038 } 11038 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
11080 void _validate(int scriptIndex, HtmlScriptElement script) { 11080 void _validate(int scriptIndex, HtmlScriptElement script) {
11081 if (_expectedLibrary != null) { 11081 if (_expectedLibrary != null) {
11082 _validateEmbedded(scriptIndex, script); 11082 _validateEmbedded(scriptIndex, script);
11083 } else { 11083 } else {
11084 _validateExternal(scriptIndex, script); 11084 _validateExternal(scriptIndex, script);
11085 } 11085 }
11086 } 11086 }
11087 void _validateEmbedded(int scriptIndex, HtmlScriptElement script) { 11087 void _validateEmbedded(int scriptIndex, HtmlScriptElement script) {
11088 if (script is! EmbeddedHtmlScriptElementImpl) { 11088 if (script is! EmbeddedHtmlScriptElementImpl) {
11089 JUnitTestCase.fail( 11089 JUnitTestCase.fail(
11090 "Expected script ${scriptIndex} to be embedded, but found ${(script != null ? script.runtimeType : "null")}"); 11090 "Expected script $scriptIndex to be embedded, but found ${(script != n ull ? script.runtimeType : "null")}");
11091 } 11091 }
11092 EmbeddedHtmlScriptElementImpl embeddedScript = 11092 EmbeddedHtmlScriptElementImpl embeddedScript =
11093 script as EmbeddedHtmlScriptElementImpl; 11093 script as EmbeddedHtmlScriptElementImpl;
11094 _expectedLibrary._validate(scriptIndex, embeddedScript); 11094 _expectedLibrary._validate(scriptIndex, embeddedScript);
11095 } 11095 }
11096 void _validateExternal(int scriptIndex, HtmlScriptElement script) { 11096 void _validateExternal(int scriptIndex, HtmlScriptElement script) {
11097 if (script is! ExternalHtmlScriptElementImpl) { 11097 if (script is! ExternalHtmlScriptElementImpl) {
11098 JUnitTestCase.fail( 11098 JUnitTestCase.fail(
11099 "Expected script ${scriptIndex} to be external with src=${_expectedExt ernalScriptName} but found ${(script != null ? script.runtimeType : "null")}"); 11099 "Expected script $scriptIndex to be external with src=$_expectedExtern alScriptName but found ${(script != null ? script.runtimeType : "null")}");
11100 } 11100 }
11101 ExternalHtmlScriptElementImpl externalScript = 11101 ExternalHtmlScriptElementImpl externalScript =
11102 script as ExternalHtmlScriptElementImpl; 11102 script as ExternalHtmlScriptElementImpl;
11103 Source scriptSource = externalScript.scriptSource; 11103 Source scriptSource = externalScript.scriptSource;
11104 if (_expectedExternalScriptName == null) { 11104 if (_expectedExternalScriptName == null) {
11105 JUnitTestCase.assertNullMsg("script ${scriptIndex}", scriptSource); 11105 JUnitTestCase.assertNullMsg("script $scriptIndex", scriptSource);
11106 } else { 11106 } else {
11107 JUnitTestCase.assertNotNullMsg("script ${scriptIndex}", scriptSource); 11107 JUnitTestCase.assertNotNullMsg("script $scriptIndex", scriptSource);
11108 String actualExternalScriptName = scriptSource.shortName; 11108 String actualExternalScriptName = scriptSource.shortName;
11109 JUnitTestCase.assertEqualsMsg( 11109 JUnitTestCase.assertEqualsMsg(
11110 "script ${scriptIndex}", 11110 "script $scriptIndex",
11111 _expectedExternalScriptName, 11111 _expectedExternalScriptName,
11112 actualExternalScriptName); 11112 actualExternalScriptName);
11113 } 11113 }
11114 } 11114 }
11115 } 11115 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/services/runtime/log.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698