| Index: packages/analyzer/test/generated/utilities_test.dart
|
| diff --git a/packages/analyzer/test/generated/utilities_test.dart b/packages/analyzer/test/generated/utilities_test.dart
|
| index 24263e726e1c70fa6f4f2a9f3baad6b49c87f88b..8e23ae1bece10f229620842d402df56e7989a34d 100644
|
| --- a/packages/analyzer/test/generated/utilities_test.dart
|
| +++ b/packages/analyzer/test/generated/utilities_test.dart
|
| @@ -2,37 +2,40 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library engine.utilities_test;
|
| +library analyzer.test.generated.utilities_test;
|
|
|
| import 'dart:collection';
|
|
|
| -import 'package:analyzer/src/generated/ast.dart';
|
| -import 'package:analyzer/src/generated/java_core.dart';
|
| +import 'package:analyzer/dart/ast/ast.dart';
|
| +import 'package:analyzer/dart/ast/token.dart';
|
| +import 'package:analyzer/src/dart/ast/token.dart';
|
| +import 'package:analyzer/src/dart/ast/utilities.dart';
|
| +import 'package:analyzer/src/dart/scanner/reader.dart';
|
| +import 'package:analyzer/src/dart/scanner/scanner.dart';
|
| import 'package:analyzer/src/generated/java_engine.dart';
|
| -import 'package:analyzer/src/generated/scanner.dart';
|
| +import 'package:analyzer/src/generated/parser.dart';
|
| import 'package:analyzer/src/generated/source.dart';
|
| import 'package:analyzer/src/generated/testing/ast_factory.dart';
|
| import 'package:analyzer/src/generated/testing/token_factory.dart';
|
| import 'package:analyzer/src/generated/utilities_collection.dart';
|
| +import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| import 'package:unittest/unittest.dart';
|
|
|
| -import '../reflective_tests.dart';
|
| import '../utils.dart';
|
| import 'test_support.dart';
|
|
|
| main() {
|
| initializeTestEnvironment();
|
| - runReflectiveTests(AstClonerTest);
|
| - runReflectiveTests(NodeReplacerTest);
|
| - runReflectiveTests(LineInfoTest);
|
| - runReflectiveTests(SourceRangeTest);
|
| - runReflectiveTests(BooleanArrayTest);
|
| - runReflectiveTests(DirectedGraphTest);
|
| - runReflectiveTests(ListUtilitiesTest);
|
| - runReflectiveTests(MultipleMapIteratorTest);
|
| - runReflectiveTests(SingleMapIteratorTest);
|
| - runReflectiveTests(TokenMapTest);
|
| - runReflectiveTests(StringUtilitiesTest);
|
| + defineReflectiveTests(AstClonerTest);
|
| + defineReflectiveTests(NodeReplacerTest);
|
| + defineReflectiveTests(LineInfoTest);
|
| + defineReflectiveTests(SourceRangeTest);
|
| + defineReflectiveTests(BooleanArrayTest);
|
| + defineReflectiveTests(DirectedGraphTest);
|
| + defineReflectiveTests(MultipleMapIteratorTest);
|
| + defineReflectiveTests(SingleMapIteratorTest);
|
| + defineReflectiveTests(TokenMapTest);
|
| + defineReflectiveTests(StringUtilitiesTest);
|
| }
|
|
|
| class AstCloneComparator extends AstComparator {
|
| @@ -55,6 +58,12 @@ class AstCloneComparator extends AstComparator {
|
| fail('Failed to copy token: ${first.lexeme} (${first.offset})');
|
| return false;
|
| }
|
| + if (first is TokenWithComment) {
|
| + CommentToken comment = first.precedingComments;
|
| + if (comment.parent != first) {
|
| + fail('Failed to link the comment "$comment" with the token "$first".');
|
| + }
|
| + }
|
| return super.isEqualTokens(first, second);
|
| }
|
| }
|
| @@ -62,1663 +71,1053 @@ class AstCloneComparator extends AstComparator {
|
| @reflectiveTest
|
| class AstClonerTest extends EngineTestCase {
|
| void test_visitAdjacentStrings() {
|
| - _assertClone(AstFactory
|
| - .adjacentStrings([AstFactory.string2("a"), AstFactory.string2("b")]));
|
| + _assertCloneExpression("'a' 'b'");
|
| }
|
|
|
| void test_visitAnnotation_constant() {
|
| - _assertClone(AstFactory.annotation(AstFactory.identifier3("A")));
|
| + _assertCloneUnitMember('@A main() {}');
|
| }
|
|
|
| void test_visitAnnotation_constructor() {
|
| - _assertClone(AstFactory.annotation2(AstFactory.identifier3("A"),
|
| - AstFactory.identifier3("c"), AstFactory.argumentList()));
|
| + _assertCloneUnitMember('@A.c() main() {}');
|
| + }
|
| +
|
| + void test_visitAnnotation_withComment() {
|
| + CompilationUnitMember clazz =
|
| + _parseUnitMember('/** comment */ @deprecated class A {}');
|
| + Annotation annotation = clazz.metadata.single;
|
| + _assertClone(annotation);
|
| }
|
|
|
| void test_visitArgumentList() {
|
| - _assertClone(AstFactory.argumentList(
|
| - [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
|
| + _assertCloneExpression('m(a, b)');
|
| }
|
|
|
| void test_visitAsExpression() {
|
| - _assertClone(AstFactory.asExpression(
|
| - AstFactory.identifier3("e"), AstFactory.typeName4("T")));
|
| + _assertCloneExpression('e as T');
|
| }
|
|
|
| void test_visitAssertStatement() {
|
| - _assertClone(AstFactory.assertStatement(AstFactory.identifier3("a")));
|
| + _assertCloneStatement('assert(a);');
|
| }
|
|
|
| void test_visitAssignmentExpression() {
|
| - _assertClone(AstFactory.assignmentExpression(AstFactory.identifier3("a"),
|
| - TokenType.EQ, AstFactory.identifier3("b")));
|
| + _assertCloneStatement('a = b;');
|
| }
|
|
|
| void test_visitAwaitExpression() {
|
| - _assertClone(AstFactory.awaitExpression(AstFactory.identifier3("a")));
|
| + _assertCloneStatement('await a;');
|
| }
|
|
|
| void test_visitBinaryExpression() {
|
| - _assertClone(AstFactory.binaryExpression(AstFactory.identifier3("a"),
|
| - TokenType.PLUS, AstFactory.identifier3("b")));
|
| + _assertCloneExpression('a + b');
|
| }
|
|
|
| void test_visitBlock_empty() {
|
| - _assertClone(AstFactory.block());
|
| + _assertCloneStatement('{}');
|
| }
|
|
|
| void test_visitBlock_nonEmpty() {
|
| - _assertClone(AstFactory
|
| - .block([AstFactory.breakStatement(), AstFactory.breakStatement()]));
|
| + _assertCloneStatement('{ print(1); print(2); }');
|
| }
|
|
|
| void test_visitBlockFunctionBody() {
|
| - _assertClone(AstFactory.blockFunctionBody2());
|
| + _assertCloneUnitMember('main() {}');
|
| }
|
|
|
| void test_visitBooleanLiteral_false() {
|
| - _assertClone(AstFactory.booleanLiteral(false));
|
| + _assertCloneExpression('false');
|
| }
|
|
|
| void test_visitBooleanLiteral_true() {
|
| - _assertClone(AstFactory.booleanLiteral(true));
|
| + _assertCloneExpression('true');
|
| }
|
|
|
| void test_visitBreakStatement_label() {
|
| - _assertClone(AstFactory.breakStatement2("l"));
|
| + _assertCloneStatement('l: while(true) { break l; }');
|
| }
|
|
|
| void test_visitBreakStatement_noLabel() {
|
| - _assertClone(AstFactory.breakStatement());
|
| + _assertCloneStatement('while(true) { break; }');
|
| }
|
|
|
| void test_visitCascadeExpression_field() {
|
| - _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
|
| - AstFactory.cascadedPropertyAccess("b"),
|
| - AstFactory.cascadedPropertyAccess("c")
|
| - ]));
|
| + _assertCloneExpression('a..b..c');
|
| }
|
|
|
| void test_visitCascadeExpression_index() {
|
| - _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
|
| - AstFactory.cascadedIndexExpression(AstFactory.integer(0)),
|
| - AstFactory.cascadedIndexExpression(AstFactory.integer(1))
|
| - ]));
|
| + _assertCloneExpression('a..[0]..[1]');
|
| }
|
|
|
| void test_visitCascadeExpression_method() {
|
| - _assertClone(AstFactory.cascadeExpression(AstFactory.identifier3("a"), [
|
| - AstFactory.cascadedMethodInvocation("b"),
|
| - AstFactory.cascadedMethodInvocation("c")
|
| - ]));
|
| + _assertCloneExpression('a..b()..c()');
|
| }
|
|
|
| void test_visitCatchClause_catch_noStack() {
|
| - _assertClone(AstFactory.catchClause("e"));
|
| + _assertCloneStatement('try {} catch (e) {}');
|
| }
|
|
|
| void test_visitCatchClause_catch_stack() {
|
| - _assertClone(AstFactory.catchClause2("e", "s"));
|
| + _assertCloneStatement('try {} catch (e, s) {}');
|
| }
|
|
|
| void test_visitCatchClause_on() {
|
| - _assertClone(AstFactory.catchClause3(AstFactory.typeName4("E")));
|
| + _assertCloneStatement('try {} on E {}');
|
| }
|
|
|
| void test_visitCatchClause_on_catch() {
|
| - _assertClone(AstFactory.catchClause4(AstFactory.typeName4("E"), "e"));
|
| + _assertCloneStatement('try {} on E catch (e) {}');
|
| }
|
|
|
| void test_visitClassDeclaration_abstract() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - Keyword.ABSTRACT, "C", null, null, null, null));
|
| + _assertCloneUnitMember('abstract class C {}');
|
| }
|
|
|
| void test_visitClassDeclaration_empty() {
|
| - _assertClone(
|
| - AstFactory.classDeclaration(null, "C", null, null, null, null));
|
| + _assertCloneUnitMember('class C {}');
|
| }
|
|
|
| void test_visitClassDeclaration_extends() {
|
| - _assertClone(AstFactory.classDeclaration(null, "C", null,
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")), null, null));
|
| + _assertCloneUnitMember('class C extends A {}');
|
| }
|
|
|
| void test_visitClassDeclaration_extends_implements() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - null,
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - null,
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C extends A implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_extends_with() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - null,
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - AstFactory.withClause([AstFactory.typeName4("M")]),
|
| - null));
|
| + _assertCloneUnitMember('class C extends A with M {}');
|
| }
|
|
|
| void test_visitClassDeclaration_extends_with_implements() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - null,
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - AstFactory.withClause([AstFactory.typeName4("M")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C extends A with M implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_implements() {
|
| - _assertClone(AstFactory.classDeclaration(null, "C", null, null, null,
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_multipleMember() {
|
| - _assertClone(
|
| - AstFactory.classDeclaration(null, "C", null, null, null, null, [
|
| - AstFactory.fieldDeclaration2(
|
| - false, Keyword.VAR, [AstFactory.variableDeclaration("a")]),
|
| - AstFactory.fieldDeclaration2(
|
| - false, Keyword.VAR, [AstFactory.variableDeclaration("b")])
|
| - ]));
|
| + _assertCloneUnitMember('class C { var a; var b; }');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null, "C", AstFactory.typeParameterList(["E"]), null, null, null));
|
| + _assertCloneUnitMember('class C<E> {}');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters_extends() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - null,
|
| - null));
|
| + _assertCloneUnitMember('class C<E> extends A {}');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters_extends_implements() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - null,
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C<E> extends A implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters_extends_with() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - AstFactory.withClause([AstFactory.typeName4("M")]),
|
| - null));
|
| + _assertCloneUnitMember('class C<E> extends A with M {}');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters_extends_with_implements() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - AstFactory.extendsClause(AstFactory.typeName4("A")),
|
| - AstFactory.withClause([AstFactory.typeName4("M")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C<E> extends A with M implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_parameters_implements() {
|
| - _assertClone(AstFactory.classDeclaration(
|
| - null,
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - null,
|
| - null,
|
| - AstFactory.implementsClause([AstFactory.typeName4("B")])));
|
| + _assertCloneUnitMember('class C<E> implements B {}');
|
| }
|
|
|
| void test_visitClassDeclaration_singleMember() {
|
| - _assertClone(
|
| - AstFactory.classDeclaration(null, "C", null, null, null, null, [
|
| - AstFactory.fieldDeclaration2(
|
| - false, Keyword.VAR, [AstFactory.variableDeclaration("a")])
|
| - ]));
|
| + _assertCloneUnitMember('class C { var a; }');
|
| }
|
|
|
| void test_visitClassDeclaration_withMetadata() {
|
| - ClassDeclaration declaration =
|
| - AstFactory.classDeclaration(null, "C", null, null, null, null);
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('@deprecated class C {}');
|
| }
|
|
|
| void test_visitClassTypeAlias_abstract() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - null,
|
| - Keyword.ABSTRACT,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - null));
|
| + _assertCloneUnitMember('abstract class C = S with M1;');
|
| }
|
|
|
| void test_visitClassTypeAlias_abstract_implements() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - null,
|
| - Keyword.ABSTRACT,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("I")])));
|
| + _assertCloneUnitMember('abstract class C = S with M1 implements I;');
|
| }
|
|
|
| void test_visitClassTypeAlias_generic() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - null,
|
| - AstFactory.typeName4("S", [AstFactory.typeName4("E")]),
|
| - AstFactory.withClause([
|
| - AstFactory.typeName4("M1", [AstFactory.typeName4("E")])
|
| - ]),
|
| - null));
|
| + _assertCloneUnitMember('class C<E> = S<E> with M1<E>;');
|
| }
|
|
|
| void test_visitClassTypeAlias_implements() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - null,
|
| - null,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("I")])));
|
| + _assertCloneUnitMember('class C = S with M1 implements I;');
|
| }
|
|
|
| void test_visitClassTypeAlias_minimal() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - null,
|
| - null,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - null));
|
| + _assertCloneUnitMember('class C = S with M1;');
|
| }
|
|
|
| void test_visitClassTypeAlias_parameters_abstract() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - Keyword.ABSTRACT,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - null));
|
| + _assertCloneUnitMember('abstract class C = S<E> with M1;');
|
| }
|
|
|
| void test_visitClassTypeAlias_parameters_abstract_implements() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - Keyword.ABSTRACT,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("I")])));
|
| + _assertCloneUnitMember('abstract class C = S<E> with M1 implements I;');
|
| }
|
|
|
| void test_visitClassTypeAlias_parameters_implements() {
|
| - _assertClone(AstFactory.classTypeAlias(
|
| - "C",
|
| - AstFactory.typeParameterList(["E"]),
|
| - null,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - AstFactory.implementsClause([AstFactory.typeName4("I")])));
|
| + _assertCloneUnitMember('class C = S<E> with M1 implements I;');
|
| }
|
|
|
| void test_visitClassTypeAlias_withMetadata() {
|
| - ClassTypeAlias declaration = AstFactory.classTypeAlias(
|
| - "C",
|
| - null,
|
| - null,
|
| - AstFactory.typeName4("S"),
|
| - AstFactory.withClause([AstFactory.typeName4("M1")]),
|
| - null);
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('@deprecated class C = S with M;');
|
| }
|
|
|
| void test_visitComment() {
|
| - _assertClone(Comment.createBlockComment(
|
| - <Token>[TokenFactory.tokenFromString("/* comment */")]));
|
| + _assertCloneUnitMember('main() { print(1); /* comment */ print(2); }');
|
| + }
|
| +
|
| + void test_visitComment_beginToken() {
|
| + _assertCloneUnitMember('/** comment */ main() {}');
|
| }
|
|
|
| void test_visitCommentReference() {
|
| - _assertClone(new CommentReference(null, AstFactory.identifier3("a")));
|
| + _assertCloneUnitMember('/** ref [a]. */ main(a) {}');
|
| }
|
|
|
| void test_visitCompilationUnit_declaration() {
|
| - _assertClone(AstFactory.compilationUnit2([
|
| - AstFactory.topLevelVariableDeclaration2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("a")])
|
| - ]));
|
| + _assertCloneUnitMember('var a;');
|
| }
|
|
|
| void test_visitCompilationUnit_directive() {
|
| - _assertClone(
|
| - AstFactory.compilationUnit3([AstFactory.libraryDirective2("l")]));
|
| + _assertCloneUnit('library l;');
|
| }
|
|
|
| void test_visitCompilationUnit_directive_declaration() {
|
| - _assertClone(AstFactory.compilationUnit4([
|
| - AstFactory.libraryDirective2("l")
|
| - ], [
|
| - AstFactory.topLevelVariableDeclaration2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("a")])
|
| - ]));
|
| + _assertCloneUnit('library l; var a;');
|
| + }
|
| +
|
| + void test_visitCompilationUnit_directive_withComment() {
|
| + _assertCloneUnit(r'''
|
| +/// aaa
|
| +/// bbb
|
| +library l;''');
|
| }
|
|
|
| void test_visitCompilationUnit_empty() {
|
| - _assertClone(AstFactory.compilationUnit());
|
| + _assertCloneUnit('');
|
| }
|
|
|
| void test_visitCompilationUnit_script() {
|
| - _assertClone(AstFactory.compilationUnit5("!#/bin/dartvm"));
|
| + _assertCloneUnit('#!/bin/dartvm');
|
| }
|
|
|
| void test_visitCompilationUnit_script_declaration() {
|
| - _assertClone(AstFactory.compilationUnit6("!#/bin/dartvm", [
|
| - AstFactory.topLevelVariableDeclaration2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("a")])
|
| - ]));
|
| + _assertCloneUnit('#!/bin/dartvm \n var a;');
|
| }
|
|
|
| void test_visitCompilationUnit_script_directive() {
|
| - _assertClone(AstFactory.compilationUnit7(
|
| - "!#/bin/dartvm", [AstFactory.libraryDirective2("l")]));
|
| + _assertCloneUnit('#!/bin/dartvm \n library l;');
|
| }
|
|
|
| void test_visitCompilationUnit_script_directives_declarations() {
|
| - _assertClone(AstFactory.compilationUnit8("!#/bin/dartvm", [
|
| - AstFactory.libraryDirective2("l")
|
| - ], [
|
| - AstFactory.topLevelVariableDeclaration2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("a")])
|
| - ]));
|
| + _assertCloneUnit('#!/bin/dartvm \n library l; var a;');
|
| }
|
|
|
| void test_visitConditionalExpression() {
|
| - _assertClone(AstFactory.conditionalExpression(AstFactory.identifier3("a"),
|
| - AstFactory.identifier3("b"), AstFactory.identifier3("c")));
|
| + _assertCloneExpression('a ? b : c');
|
| }
|
|
|
| void test_visitConstructorDeclaration_const() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - Keyword.CONST,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList(),
|
| - null,
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { const C(); }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_external() {
|
| - _assertClone(AstFactory.constructorDeclaration(AstFactory.identifier3("C"),
|
| - null, AstFactory.formalParameterList(), null));
|
| + _assertCloneUnitMember('class C { external C(); }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_minimal() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList(),
|
| - null,
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { C() {} }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_multipleInitializers() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList(),
|
| - [
|
| - AstFactory.constructorFieldInitializer(
|
| - false, "a", AstFactory.identifier3("b")),
|
| - AstFactory.constructorFieldInitializer(
|
| - false, "c", AstFactory.identifier3("d"))
|
| - ],
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { C() : a = b, c = d {} }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_multipleParameters() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "b")
|
| - ]),
|
| - null,
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { C(var a, var b) {} }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_named() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - "m",
|
| - AstFactory.formalParameterList(),
|
| - null,
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { C.m() {} }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_singleInitializer() {
|
| - _assertClone(AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList(),
|
| - [
|
| - AstFactory.constructorFieldInitializer(
|
| - false, "a", AstFactory.identifier3("b"))
|
| - ],
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { C() : a = b {} }');
|
| }
|
|
|
| void test_visitConstructorDeclaration_withMetadata() {
|
| - ConstructorDeclaration declaration = AstFactory.constructorDeclaration2(
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("C"),
|
| - null,
|
| - AstFactory.formalParameterList(),
|
| - null,
|
| - AstFactory.blockFunctionBody2());
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('class C { @deprecated C() {} }');
|
| }
|
|
|
| void test_visitConstructorFieldInitializer_withoutThis() {
|
| - _assertClone(AstFactory.constructorFieldInitializer(
|
| - false, "a", AstFactory.identifier3("b")));
|
| + _assertCloneUnitMember('class C { C() : a = b {} }');
|
| }
|
|
|
| void test_visitConstructorFieldInitializer_withThis() {
|
| - _assertClone(AstFactory.constructorFieldInitializer(
|
| - true, "a", AstFactory.identifier3("b")));
|
| + _assertCloneUnitMember('class C { C() : this.a = b {} }');
|
| }
|
|
|
| void test_visitConstructorName_named_prefix() {
|
| - _assertClone(
|
| - AstFactory.constructorName(AstFactory.typeName4("p.C.n"), null));
|
| + _assertCloneExpression('new p.C.n()');
|
| }
|
|
|
| void test_visitConstructorName_unnamed_noPrefix() {
|
| - _assertClone(AstFactory.constructorName(AstFactory.typeName4("C"), null));
|
| + _assertCloneExpression('new C()');
|
| }
|
|
|
| void test_visitConstructorName_unnamed_prefix() {
|
| - _assertClone(AstFactory.constructorName(
|
| - AstFactory.typeName3(AstFactory.identifier5("p", "C")), null));
|
| + _assertCloneExpression('new p.C()');
|
| }
|
|
|
| void test_visitContinueStatement_label() {
|
| - _assertClone(AstFactory.continueStatement("l"));
|
| + _assertCloneStatement('l: while (true) { continue l; }');
|
| }
|
|
|
| void test_visitContinueStatement_noLabel() {
|
| - _assertClone(AstFactory.continueStatement());
|
| + _assertCloneStatement('while (true) { continue; }');
|
| }
|
|
|
| void test_visitDefaultFormalParameter_named_noValue() {
|
| - _assertClone(AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("p"), null));
|
| + _assertCloneUnitMember('main({p}) {}');
|
| }
|
|
|
| void test_visitDefaultFormalParameter_named_value() {
|
| - _assertClone(AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
|
| + _assertCloneUnitMember('main({p : 0}) {}');
|
| }
|
|
|
| void test_visitDefaultFormalParameter_positional_noValue() {
|
| - _assertClone(AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("p"), null));
|
| + _assertCloneUnitMember('main([p]) {}');
|
| }
|
|
|
| void test_visitDefaultFormalParameter_positional_value() {
|
| - _assertClone(AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("p"), AstFactory.integer(0)));
|
| + _assertCloneUnitMember('main([p = 0]) {}');
|
| }
|
|
|
| void test_visitDoStatement() {
|
| - _assertClone(AstFactory.doStatement(
|
| - AstFactory.block(), AstFactory.identifier3("c")));
|
| + _assertCloneStatement('do {} while (c);');
|
| }
|
|
|
| void test_visitDoubleLiteral() {
|
| - _assertClone(AstFactory.doubleLiteral(4.2));
|
| + _assertCloneExpression('4.2');
|
| }
|
|
|
| void test_visitEmptyFunctionBody() {
|
| - _assertClone(AstFactory.emptyFunctionBody());
|
| + _assertCloneUnitMember('main() {}');
|
| }
|
|
|
| void test_visitEmptyStatement() {
|
| - _assertClone(AstFactory.emptyStatement());
|
| + _assertCloneUnitMember('main() { ; }');
|
| }
|
|
|
| void test_visitExportDirective_combinator() {
|
| - _assertClone(AstFactory.exportDirective2("a.dart", [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")])
|
| - ]));
|
| + _assertCloneUnit('export "a.dart" show A;');
|
| }
|
|
|
| void test_visitExportDirective_combinators() {
|
| - _assertClone(AstFactory.exportDirective2("a.dart", [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")]),
|
| - AstFactory.hideCombinator([AstFactory.identifier3("B")])
|
| - ]));
|
| + _assertCloneUnit('export "a.dart" show A hide B;');
|
| }
|
|
|
| void test_visitExportDirective_minimal() {
|
| - _assertClone(AstFactory.exportDirective2("a.dart"));
|
| + _assertCloneUnit('export "a.dart";');
|
| }
|
|
|
| void test_visitExportDirective_withMetadata() {
|
| - ExportDirective directive = AstFactory.exportDirective2("a.dart");
|
| - directive.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(directive);
|
| + _assertCloneUnit('@deprecated export "a.dart";');
|
| }
|
|
|
| void test_visitExpressionFunctionBody() {
|
| - _assertClone(
|
| - AstFactory.expressionFunctionBody(AstFactory.identifier3("a")));
|
| + _assertCloneUnitMember('main() => a;');
|
| }
|
|
|
| void test_visitExpressionStatement() {
|
| - _assertClone(AstFactory.expressionStatement(AstFactory.identifier3("a")));
|
| + _assertCloneStatement('a;');
|
| }
|
|
|
| void test_visitExtendsClause() {
|
| - _assertClone(AstFactory.extendsClause(AstFactory.typeName4("C")));
|
| + _assertCloneUnitMember('class A extends B {}');
|
| }
|
|
|
| void test_visitFieldDeclaration_instance() {
|
| - _assertClone(AstFactory.fieldDeclaration2(
|
| - false, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
|
| + _assertCloneUnitMember('class C { var a; }');
|
| }
|
|
|
| void test_visitFieldDeclaration_static() {
|
| - _assertClone(AstFactory.fieldDeclaration2(
|
| - true, Keyword.VAR, [AstFactory.variableDeclaration("a")]));
|
| + _assertCloneUnitMember('class C { static var a; }');
|
| }
|
|
|
| void test_visitFieldDeclaration_withMetadata() {
|
| - FieldDeclaration declaration = AstFactory.fieldDeclaration2(
|
| - false, Keyword.VAR, [AstFactory.variableDeclaration("a")]);
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('class C { @deprecated var a; }');
|
| }
|
|
|
| void test_visitFieldFormalParameter_functionTyped() {
|
| - _assertClone(AstFactory.fieldFormalParameter(
|
| - null,
|
| - AstFactory.typeName4("A"),
|
| - "a",
|
| - AstFactory
|
| - .formalParameterList([AstFactory.simpleFormalParameter3("b")])));
|
| + _assertCloneUnitMember('class C { C(A this.a(b)); }');
|
| }
|
|
|
| void test_visitFieldFormalParameter_keyword() {
|
| - _assertClone(AstFactory.fieldFormalParameter(Keyword.VAR, null, "a"));
|
| + _assertCloneUnitMember('class C { C(var this.a); }');
|
| }
|
|
|
| void test_visitFieldFormalParameter_keywordAndType() {
|
| - _assertClone(AstFactory.fieldFormalParameter(
|
| - Keyword.FINAL, AstFactory.typeName4("A"), "a"));
|
| + _assertCloneUnitMember('class C { C(final A this.a); }');
|
| }
|
|
|
| void test_visitFieldFormalParameter_type() {
|
| - _assertClone(
|
| - AstFactory.fieldFormalParameter(null, AstFactory.typeName4("A"), "a"));
|
| + _assertCloneUnitMember('class C { C(A this.a); }');
|
| }
|
|
|
| void test_visitForEachStatement_declared() {
|
| - _assertClone(AstFactory.forEachStatement(
|
| - AstFactory.declaredIdentifier3("a"),
|
| - AstFactory.identifier3("b"),
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (var a in b) {}');
|
| }
|
|
|
| void test_visitForEachStatement_variable() {
|
| - _assertClone(new ForEachStatement.withReference(
|
| - null,
|
| - TokenFactory.tokenFromKeyword(Keyword.FOR),
|
| - TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
| - AstFactory.identifier3("a"),
|
| - TokenFactory.tokenFromKeyword(Keyword.IN),
|
| - AstFactory.identifier3("b"),
|
| - TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (a in b) {}');
|
| }
|
|
|
| void test_visitForEachStatement_variable_await() {
|
| - _assertClone(new ForEachStatement.withReference(
|
| - TokenFactory.tokenFromString("await"),
|
| - TokenFactory.tokenFromKeyword(Keyword.FOR),
|
| - TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
|
| - AstFactory.identifier3("a"),
|
| - TokenFactory.tokenFromKeyword(Keyword.IN),
|
| - AstFactory.identifier3("b"),
|
| - TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
|
| - AstFactory.block()));
|
| + _assertCloneUnitMember('main(s) async { await for (a in s) {} }');
|
| }
|
|
|
| void test_visitFormalParameterList_empty() {
|
| - _assertClone(AstFactory.formalParameterList());
|
| + _assertCloneUnitMember('main() {}');
|
| }
|
|
|
| void test_visitFormalParameterList_n() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
|
| - ]));
|
| + _assertCloneUnitMember('main({a: 0}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_nn() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
|
| - ]));
|
| + _assertCloneUnitMember('main({a: 0, b: 1}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_p() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0))
|
| - ]));
|
| + _assertCloneUnitMember('main([a = 0]) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_pp() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("a"), AstFactory.integer(0)),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
|
| - ]));
|
| + _assertCloneUnitMember('main([a = 0, b = 1]) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_r() {
|
| - _assertClone(AstFactory
|
| - .formalParameterList([AstFactory.simpleFormalParameter3("a")]));
|
| + _assertCloneUnitMember('main(a) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rn() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, {b: 1}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rnn() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, {b: 1, c: 2}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rp() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, [b = 1]) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rpp() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("b"), AstFactory.integer(1)),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(2))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, [b = 1, c = 2]) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rr() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.simpleFormalParameter3("b")
|
| - ]));
|
| + _assertCloneUnitMember('main(a, b) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rrn() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.simpleFormalParameter3("b"),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, b, {c: 3}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rrnn() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.simpleFormalParameter3("b"),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
|
| - AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, b, {c: 3, d: 4}) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rrp() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.simpleFormalParameter3("b"),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, b, [c = 3]) {}');
|
| }
|
|
|
| void test_visitFormalParameterList_rrpp() {
|
| - _assertClone(AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter3("a"),
|
| - AstFactory.simpleFormalParameter3("b"),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("c"), AstFactory.integer(3)),
|
| - AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter3("d"), AstFactory.integer(4))
|
| - ]));
|
| + _assertCloneUnitMember('main(a, b, [c = 3, d = 4]) {}');
|
| }
|
|
|
| void test_visitForStatement_c() {
|
| - _assertClone(AstFactory.forStatement(
|
| - null, AstFactory.identifier3("c"), null, AstFactory.block()));
|
| + _assertCloneStatement('for (; c;) {}');
|
| }
|
|
|
| void test_visitForStatement_cu() {
|
| - _assertClone(AstFactory.forStatement(null, AstFactory.identifier3("c"),
|
| - [AstFactory.identifier3("u")], AstFactory.block()));
|
| + _assertCloneStatement('for (; c; u) {}');
|
| }
|
|
|
| void test_visitForStatement_e() {
|
| - _assertClone(AstFactory.forStatement(
|
| - AstFactory.identifier3("e"), null, null, AstFactory.block()));
|
| + _assertCloneStatement('for (e; ;) {}');
|
| }
|
|
|
| void test_visitForStatement_ec() {
|
| - _assertClone(AstFactory.forStatement(AstFactory.identifier3("e"),
|
| - AstFactory.identifier3("c"), null, AstFactory.block()));
|
| + _assertCloneStatement('for (e; c;) {}');
|
| }
|
|
|
| void test_visitForStatement_ecu() {
|
| - _assertClone(AstFactory.forStatement(
|
| - AstFactory.identifier3("e"),
|
| - AstFactory.identifier3("c"),
|
| - [AstFactory.identifier3("u")],
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (e; c; u) {}');
|
| }
|
|
|
| void test_visitForStatement_eu() {
|
| - _assertClone(AstFactory.forStatement(AstFactory.identifier3("e"), null,
|
| - [AstFactory.identifier3("u")], AstFactory.block()));
|
| + _assertCloneStatement('for (e; ; u) {}');
|
| }
|
|
|
| void test_visitForStatement_i() {
|
| - _assertClone(AstFactory.forStatement2(
|
| - AstFactory.variableDeclarationList2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("i")]),
|
| - null,
|
| - null,
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (var i; ;) {}');
|
| }
|
|
|
| void test_visitForStatement_ic() {
|
| - _assertClone(AstFactory.forStatement2(
|
| - AstFactory.variableDeclarationList2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("i")]),
|
| - AstFactory.identifier3("c"),
|
| - null,
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (var i; c;) {}');
|
| }
|
|
|
| void test_visitForStatement_icu() {
|
| - _assertClone(AstFactory.forStatement2(
|
| - AstFactory.variableDeclarationList2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("i")]),
|
| - AstFactory.identifier3("c"),
|
| - [AstFactory.identifier3("u")],
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (var i; c; u) {}');
|
| }
|
|
|
| void test_visitForStatement_iu() {
|
| - _assertClone(AstFactory.forStatement2(
|
| - AstFactory.variableDeclarationList2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("i")]),
|
| - null,
|
| - [AstFactory.identifier3("u")],
|
| - AstFactory.block()));
|
| + _assertCloneStatement('for (var i; ; u) {}');
|
| }
|
|
|
| void test_visitForStatement_u() {
|
| - _assertClone(AstFactory.forStatement(
|
| - null, null, [AstFactory.identifier3("u")], AstFactory.block()));
|
| + _assertCloneStatement('for (; ; u) {}');
|
| }
|
|
|
| void test_visitFunctionDeclaration_getter() {
|
| - _assertClone(AstFactory.functionDeclaration(
|
| - null, Keyword.GET, "f", AstFactory.functionExpression()));
|
| + _assertCloneUnitMember('get f {}');
|
| }
|
|
|
| void test_visitFunctionDeclaration_normal() {
|
| - _assertClone(AstFactory.functionDeclaration(
|
| - null, null, "f", AstFactory.functionExpression()));
|
| + _assertCloneUnitMember('f() {}');
|
| }
|
|
|
| void test_visitFunctionDeclaration_setter() {
|
| - _assertClone(AstFactory.functionDeclaration(
|
| - null, Keyword.SET, "f", AstFactory.functionExpression()));
|
| + _assertCloneUnitMember('set f(x) {}');
|
| }
|
|
|
| void test_visitFunctionDeclaration_withMetadata() {
|
| - FunctionDeclaration declaration = AstFactory.functionDeclaration(
|
| - null, null, "f", AstFactory.functionExpression());
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('@deprecated f() {}');
|
| }
|
|
|
| void test_visitFunctionDeclarationStatement() {
|
| - _assertClone(AstFactory.functionDeclarationStatement(
|
| - null, null, "f", AstFactory.functionExpression()));
|
| - }
|
| -
|
| - void test_visitFunctionExpression() {
|
| - _assertClone(AstFactory.functionExpression());
|
| + _assertCloneStatement('f() {}');
|
| }
|
|
|
| void test_visitFunctionExpressionInvocation() {
|
| - _assertClone(
|
| - AstFactory.functionExpressionInvocation(AstFactory.identifier3("f")));
|
| + _assertCloneStatement('{ () {}(); }');
|
| }
|
|
|
| void test_visitFunctionTypeAlias_generic() {
|
| - _assertClone(AstFactory.typeAlias(AstFactory.typeName4("A"), "F",
|
| - AstFactory.typeParameterList(["B"]), AstFactory.formalParameterList()));
|
| + _assertCloneUnitMember('typedef A F<B>();');
|
| }
|
|
|
| void test_visitFunctionTypeAlias_nonGeneric() {
|
| - _assertClone(AstFactory.typeAlias(AstFactory.typeName4("A"), "F", null,
|
| - AstFactory.formalParameterList()));
|
| + _assertCloneUnitMember('typedef A F();');
|
| }
|
|
|
| void test_visitFunctionTypeAlias_withMetadata() {
|
| - FunctionTypeAlias declaration = AstFactory.typeAlias(
|
| - AstFactory.typeName4("A"), "F", null, AstFactory.formalParameterList());
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('@deprecated typedef A F();');
|
| }
|
|
|
| void test_visitFunctionTypedFormalParameter_noType() {
|
| - _assertClone(AstFactory.functionTypedFormalParameter(null, "f"));
|
| + _assertCloneUnitMember('main( f() ) {}');
|
| }
|
|
|
| void test_visitFunctionTypedFormalParameter_type() {
|
| - _assertClone(AstFactory.functionTypedFormalParameter(
|
| - AstFactory.typeName4("T"), "f"));
|
| + _assertCloneUnitMember('main( T f() ) {}');
|
| }
|
|
|
| void test_visitIfStatement_withElse() {
|
| - _assertClone(AstFactory.ifStatement2(
|
| - AstFactory.identifier3("c"), AstFactory.block(), AstFactory.block()));
|
| + _assertCloneStatement('if (c) {} else {}');
|
| }
|
|
|
| void test_visitIfStatement_withoutElse() {
|
| - _assertClone(AstFactory.ifStatement(
|
| - AstFactory.identifier3("c"), AstFactory.block()));
|
| + _assertCloneStatement('if (c) {}');
|
| }
|
|
|
| void test_visitImplementsClause_multiple() {
|
| - _assertClone(AstFactory.implementsClause(
|
| - [AstFactory.typeName4("A"), AstFactory.typeName4("B")]));
|
| + _assertCloneUnitMember('class A implements B, C {}');
|
| }
|
|
|
| void test_visitImplementsClause_single() {
|
| - _assertClone(AstFactory.implementsClause([AstFactory.typeName4("A")]));
|
| + _assertCloneUnitMember('class A implements B {}');
|
| }
|
|
|
| void test_visitImportDirective_combinator() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", null, [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")])
|
| - ]));
|
| + _assertCloneUnit('import "a.dart" show A;');
|
| }
|
|
|
| void test_visitImportDirective_combinators() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", null, [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")]),
|
| - AstFactory.hideCombinator([AstFactory.identifier3("B")])
|
| - ]));
|
| + _assertCloneUnit('import "a.dart" show A hide B;');
|
| }
|
|
|
| void test_visitImportDirective_minimal() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", null));
|
| + _assertCloneUnit('import "a.dart";');
|
| }
|
|
|
| void test_visitImportDirective_prefix() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", "p"));
|
| + _assertCloneUnit('import "a.dart" as p;');
|
| }
|
|
|
| void test_visitImportDirective_prefix_combinator() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", "p", [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")])
|
| - ]));
|
| + _assertCloneUnit('import "a.dart" as p show A;');
|
| }
|
|
|
| void test_visitImportDirective_prefix_combinators() {
|
| - _assertClone(AstFactory.importDirective3("a.dart", "p", [
|
| - AstFactory.showCombinator([AstFactory.identifier3("A")]),
|
| - AstFactory.hideCombinator([AstFactory.identifier3("B")])
|
| - ]));
|
| + _assertCloneUnit('import "a.dart" as p show A hide B;');
|
| }
|
|
|
| void test_visitImportDirective_withMetadata() {
|
| - ImportDirective directive = AstFactory.importDirective3("a.dart", null);
|
| - directive.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(directive);
|
| + _assertCloneUnit('@deprecated import "a.dart";');
|
| }
|
|
|
| void test_visitImportHideCombinator_multiple() {
|
| - _assertClone(AstFactory.hideCombinator(
|
| - [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
|
| + _assertCloneUnit('import "a.dart" hide a, b;');
|
| }
|
|
|
| void test_visitImportHideCombinator_single() {
|
| - _assertClone(AstFactory.hideCombinator([AstFactory.identifier3("a")]));
|
| + _assertCloneUnit('import "a.dart" hide a;');
|
| }
|
|
|
| void test_visitImportShowCombinator_multiple() {
|
| - _assertClone(AstFactory.showCombinator(
|
| - [AstFactory.identifier3("a"), AstFactory.identifier3("b")]));
|
| + _assertCloneUnit('import "a.dart" show a, b;');
|
| }
|
|
|
| void test_visitImportShowCombinator_single() {
|
| - _assertClone(AstFactory.showCombinator([AstFactory.identifier3("a")]));
|
| + _assertCloneUnit('import "a.dart" show a;');
|
| }
|
|
|
| void test_visitIndexExpression() {
|
| - _assertClone(AstFactory.indexExpression(
|
| - AstFactory.identifier3("a"), AstFactory.identifier3("i")));
|
| + _assertCloneExpression('a[i]');
|
| }
|
|
|
| void test_visitInstanceCreationExpression_const() {
|
| - _assertClone(AstFactory.instanceCreationExpression2(
|
| - Keyword.CONST, AstFactory.typeName4("C")));
|
| + _assertCloneExpression('const C()');
|
| }
|
|
|
| void test_visitInstanceCreationExpression_named() {
|
| - _assertClone(AstFactory.instanceCreationExpression3(
|
| - Keyword.NEW, AstFactory.typeName4("C"), "c"));
|
| + _assertCloneExpression('new C.c()');
|
| }
|
|
|
| void test_visitInstanceCreationExpression_unnamed() {
|
| - _assertClone(AstFactory.instanceCreationExpression2(
|
| - Keyword.NEW, AstFactory.typeName4("C")));
|
| + _assertCloneExpression('new C()');
|
| }
|
|
|
| void test_visitIntegerLiteral() {
|
| - _assertClone(AstFactory.integer(42));
|
| + _assertCloneExpression('42');
|
| }
|
|
|
| void test_visitInterpolationExpression_expression() {
|
| - _assertClone(
|
| - AstFactory.interpolationExpression(AstFactory.identifier3("a")));
|
| + _assertCloneExpression(r'"${c}"');
|
| }
|
|
|
| void test_visitInterpolationExpression_identifier() {
|
| - _assertClone(AstFactory.interpolationExpression2("a"));
|
| - }
|
| -
|
| - void test_visitInterpolationString() {
|
| - _assertClone(AstFactory.interpolationString("'x", "x"));
|
| + _assertCloneExpression(r'"$c"');
|
| }
|
|
|
| void test_visitIsExpression_negated() {
|
| - _assertClone(AstFactory.isExpression(
|
| - AstFactory.identifier3("a"), true, AstFactory.typeName4("C")));
|
| + _assertCloneExpression('a is! C');
|
| }
|
|
|
| void test_visitIsExpression_normal() {
|
| - _assertClone(AstFactory.isExpression(
|
| - AstFactory.identifier3("a"), false, AstFactory.typeName4("C")));
|
| + _assertCloneExpression('a is C');
|
| }
|
|
|
| void test_visitLabel() {
|
| - _assertClone(AstFactory.label2("a"));
|
| + _assertCloneStatement('a: return;');
|
| }
|
|
|
| void test_visitLabeledStatement_multiple() {
|
| - _assertClone(AstFactory.labeledStatement(
|
| - [AstFactory.label2("a"), AstFactory.label2("b")],
|
| - AstFactory.returnStatement()));
|
| + _assertCloneStatement('a: b: return;');
|
| }
|
|
|
| void test_visitLabeledStatement_single() {
|
| - _assertClone(AstFactory.labeledStatement(
|
| - [AstFactory.label2("a")], AstFactory.returnStatement()));
|
| + _assertCloneStatement('a: return;');
|
| }
|
|
|
| void test_visitLibraryDirective() {
|
| - _assertClone(AstFactory.libraryDirective2("l"));
|
| + _assertCloneUnit('library l;');
|
| }
|
|
|
| void test_visitLibraryDirective_withMetadata() {
|
| - LibraryDirective directive = AstFactory.libraryDirective2("l");
|
| - directive.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(directive);
|
| + _assertCloneUnit('@deprecated library l;');
|
| }
|
|
|
| void test_visitLibraryIdentifier_multiple() {
|
| - _assertClone(AstFactory.libraryIdentifier([
|
| - AstFactory.identifier3("a"),
|
| - AstFactory.identifier3("b"),
|
| - AstFactory.identifier3("c")
|
| - ]));
|
| + _assertCloneUnit('library a.b.c;');
|
| }
|
|
|
| void test_visitLibraryIdentifier_single() {
|
| - _assertClone(AstFactory.libraryIdentifier([AstFactory.identifier3("a")]));
|
| + _assertCloneUnit('library a;');
|
| }
|
|
|
| void test_visitListLiteral_const() {
|
| - _assertClone(AstFactory.listLiteral2(Keyword.CONST, null));
|
| + _assertCloneExpression('const []');
|
| }
|
|
|
| void test_visitListLiteral_empty() {
|
| - _assertClone(AstFactory.listLiteral());
|
| + _assertCloneExpression('[]');
|
| }
|
|
|
| void test_visitListLiteral_nonEmpty() {
|
| - _assertClone(AstFactory.listLiteral([
|
| - AstFactory.identifier3("a"),
|
| - AstFactory.identifier3("b"),
|
| - AstFactory.identifier3("c")
|
| - ]));
|
| + _assertCloneExpression('[a, b, c]');
|
| }
|
|
|
| void test_visitMapLiteral_const() {
|
| - _assertClone(AstFactory.mapLiteral(Keyword.CONST, null));
|
| + _assertCloneExpression('const {}');
|
| }
|
|
|
| void test_visitMapLiteral_empty() {
|
| - _assertClone(AstFactory.mapLiteral2());
|
| + _assertCloneExpression('{}');
|
| }
|
|
|
| void test_visitMapLiteral_nonEmpty() {
|
| - _assertClone(AstFactory.mapLiteral2([
|
| - AstFactory.mapLiteralEntry("a", AstFactory.identifier3("a")),
|
| - AstFactory.mapLiteralEntry("b", AstFactory.identifier3("b")),
|
| - AstFactory.mapLiteralEntry("c", AstFactory.identifier3("c"))
|
| - ]));
|
| - }
|
| -
|
| - void test_visitMapLiteralEntry() {
|
| - _assertClone(AstFactory.mapLiteralEntry("a", AstFactory.identifier3("b")));
|
| + _assertCloneExpression('{a: a, b: b, c: c}');
|
| }
|
|
|
| void test_visitMethodDeclaration_external() {
|
| - _assertClone(AstFactory.methodDeclaration(null, null, null, null,
|
| - AstFactory.identifier3("m"), AstFactory.formalParameterList()));
|
| + _assertCloneUnitMember('class C { external m(); }');
|
| }
|
|
|
| void test_visitMethodDeclaration_external_returnType() {
|
| - _assertClone(AstFactory.methodDeclaration(
|
| - null,
|
| - AstFactory.typeName4("T"),
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList()));
|
| + _assertCloneUnitMember('class C { T m(); }');
|
| }
|
|
|
| void test_visitMethodDeclaration_getter() {
|
| - _assertClone(AstFactory.methodDeclaration2(null, null, Keyword.GET, null,
|
| - AstFactory.identifier3("m"), null, AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { get m {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_getter_returnType() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - AstFactory.typeName4("T"),
|
| - Keyword.GET,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - null,
|
| - AstFactory.blockFunctionBody2()));
|
| - }
|
| -
|
| - void test_visitMethodDeclaration_getter_seturnType() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - AstFactory.typeName4("T"),
|
| - Keyword.SET,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(
|
| - [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { T get m {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_minimal() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - null,
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { m() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_multipleParameters() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - null,
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList([
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "b")
|
| - ]),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { m(var a, var b) {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_operator() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - null,
|
| - null,
|
| - Keyword.OPERATOR,
|
| - AstFactory.identifier3("+"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { operator+() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_operator_returnType() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - AstFactory.typeName4("T"),
|
| - null,
|
| - Keyword.OPERATOR,
|
| - AstFactory.identifier3("+"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { T operator+() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_returnType() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - AstFactory.typeName4("T"),
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { T m() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_setter() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - null,
|
| - null,
|
| - Keyword.SET,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(
|
| - [AstFactory.simpleFormalParameter(Keyword.VAR, "v")]),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { set m(var v) {} }');
|
| + }
|
| +
|
| + void test_visitMethodDeclaration_setter_returnType() {
|
| + _assertCloneUnitMember('class C { T set m(v) {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_static() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - Keyword.STATIC,
|
| - null,
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { static m() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_static_returnType() {
|
| - _assertClone(AstFactory.methodDeclaration2(
|
| - Keyword.STATIC,
|
| - AstFactory.typeName4("T"),
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2()));
|
| + _assertCloneUnitMember('class C { static T m() {} }');
|
| }
|
|
|
| void test_visitMethodDeclaration_withMetadata() {
|
| - MethodDeclaration declaration = AstFactory.methodDeclaration2(
|
| - null,
|
| - null,
|
| - null,
|
| - null,
|
| - AstFactory.identifier3("m"),
|
| - AstFactory.formalParameterList(),
|
| - AstFactory.blockFunctionBody2());
|
| - declaration.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declaration);
|
| + _assertCloneUnitMember('class C { @deprecated m() {} }');
|
| }
|
|
|
| void test_visitMethodInvocation_noTarget() {
|
| - _assertClone(AstFactory.methodInvocation2("m"));
|
| + _assertCloneExpression('m()');
|
| }
|
|
|
| void test_visitMethodInvocation_target() {
|
| - _assertClone(AstFactory.methodInvocation(AstFactory.identifier3("t"), "m"));
|
| + _assertCloneExpression('t.m()');
|
| }
|
|
|
| void test_visitNamedExpression() {
|
| - _assertClone(AstFactory.namedExpression2("a", AstFactory.identifier3("b")));
|
| - }
|
| -
|
| - void test_visitNamedFormalParameter() {
|
| - _assertClone(AstFactory.namedFormalParameter(
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
|
| - AstFactory.integer(0)));
|
| + _assertCloneExpression('m(a: b)');
|
| }
|
|
|
| void test_visitNativeClause() {
|
| - _assertClone(AstFactory.nativeClause("code"));
|
| + _assertCloneUnitMember('f() native "code";');
|
| }
|
|
|
| void test_visitNativeFunctionBody() {
|
| - _assertClone(AstFactory.nativeFunctionBody("str"));
|
| + _assertCloneUnitMember('f() native "str";');
|
| }
|
|
|
| void test_visitNullLiteral() {
|
| - _assertClone(AstFactory.nullLiteral());
|
| + _assertCloneExpression('null');
|
| }
|
|
|
| void test_visitParenthesizedExpression() {
|
| - _assertClone(
|
| - AstFactory.parenthesizedExpression(AstFactory.identifier3("a")));
|
| + _assertCloneExpression('(a)');
|
| }
|
|
|
| void test_visitPartDirective() {
|
| - _assertClone(AstFactory.partDirective2("a.dart"));
|
| + _assertCloneUnit('part "a.dart";');
|
| }
|
|
|
| void test_visitPartDirective_withMetadata() {
|
| - PartDirective directive = AstFactory.partDirective2("a.dart");
|
| - directive.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(directive);
|
| + _assertCloneUnit('@deprecated part "a.dart";');
|
| }
|
|
|
| void test_visitPartOfDirective() {
|
| - _assertClone(
|
| - AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"])));
|
| + _assertCloneUnit('part of l;');
|
| }
|
|
|
| void test_visitPartOfDirective_withMetadata() {
|
| - PartOfDirective directive =
|
| - AstFactory.partOfDirective(AstFactory.libraryIdentifier2(["l"]));
|
| - directive.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(directive);
|
| + _assertCloneUnit('@deprecated part of l;');
|
| }
|
|
|
| void test_visitPositionalFormalParameter() {
|
| - _assertClone(AstFactory.positionalFormalParameter(
|
| - AstFactory.simpleFormalParameter(Keyword.VAR, "a"),
|
| - AstFactory.integer(0)));
|
| + _assertCloneUnitMember('main([var p = 0]) {}');
|
| }
|
|
|
| void test_visitPostfixExpression() {
|
| - _assertClone(AstFactory.postfixExpression(
|
| - AstFactory.identifier3("a"), TokenType.PLUS_PLUS));
|
| + _assertCloneExpression('a++');
|
| }
|
|
|
| void test_visitPrefixedIdentifier() {
|
| - _assertClone(AstFactory.identifier5("a", "b"));
|
| + _assertCloneExpression('a.b');
|
| }
|
|
|
| void test_visitPrefixExpression() {
|
| - _assertClone(AstFactory.prefixExpression(
|
| - TokenType.MINUS, AstFactory.identifier3("a")));
|
| + _assertCloneExpression('-a');
|
| }
|
|
|
| void test_visitPropertyAccess() {
|
| - _assertClone(AstFactory.propertyAccess2(AstFactory.identifier3("a"), "b"));
|
| + _assertCloneExpression('a.b.c');
|
| }
|
|
|
| void test_visitRedirectingConstructorInvocation_named() {
|
| - _assertClone(AstFactory.redirectingConstructorInvocation2("c"));
|
| + _assertCloneUnitMember('class A { factory A() = B.b; }');
|
| }
|
|
|
| void test_visitRedirectingConstructorInvocation_unnamed() {
|
| - _assertClone(AstFactory.redirectingConstructorInvocation());
|
| + _assertCloneUnitMember('class A { factory A() = B; }');
|
| }
|
|
|
| void test_visitRethrowExpression() {
|
| - _assertClone(AstFactory.rethrowExpression());
|
| + _assertCloneExpression('rethrow');
|
| }
|
|
|
| void test_visitReturnStatement_expression() {
|
| - _assertClone(AstFactory.returnStatement2(AstFactory.identifier3("a")));
|
| + _assertCloneStatement('return a;');
|
| }
|
|
|
| void test_visitReturnStatement_noExpression() {
|
| - _assertClone(AstFactory.returnStatement());
|
| + _assertCloneStatement('return;');
|
| }
|
|
|
| void test_visitScriptTag() {
|
| - String scriptTag = "!#/bin/dart.exe";
|
| - _assertClone(AstFactory.scriptTag(scriptTag));
|
| + _assertCloneUnit('#!/bin/dart.exe');
|
| }
|
|
|
| void test_visitSimpleFormalParameter_keyword() {
|
| - _assertClone(AstFactory.simpleFormalParameter(Keyword.VAR, "a"));
|
| + _assertCloneUnitMember('main(var a) {}');
|
| }
|
|
|
| void test_visitSimpleFormalParameter_keyword_type() {
|
| - _assertClone(AstFactory.simpleFormalParameter2(
|
| - Keyword.FINAL, AstFactory.typeName4("A"), "a"));
|
| + _assertCloneUnitMember('main(final A a) {}');
|
| }
|
|
|
| void test_visitSimpleFormalParameter_type() {
|
| - _assertClone(
|
| - AstFactory.simpleFormalParameter4(AstFactory.typeName4("A"), "a"));
|
| + _assertCloneUnitMember('main(A a) {}');
|
| }
|
|
|
| void test_visitSimpleIdentifier() {
|
| - _assertClone(AstFactory.identifier3("a"));
|
| + _assertCloneExpression('a');
|
| }
|
|
|
| void test_visitSimpleStringLiteral() {
|
| - _assertClone(AstFactory.string2("a"));
|
| + _assertCloneExpression("'a'");
|
| }
|
|
|
| void test_visitStringInterpolation() {
|
| - _assertClone(AstFactory.string([
|
| - AstFactory.interpolationString("'a", "a"),
|
| - AstFactory.interpolationExpression(AstFactory.identifier3("e")),
|
| - AstFactory.interpolationString("b'", "b")
|
| - ]));
|
| + _assertCloneExpression(r"'a${e}b'");
|
| }
|
|
|
| void test_visitSuperConstructorInvocation() {
|
| - _assertClone(AstFactory.superConstructorInvocation());
|
| + _assertCloneUnitMember('class C { C() : super(); }');
|
| }
|
|
|
| void test_visitSuperConstructorInvocation_named() {
|
| - _assertClone(AstFactory.superConstructorInvocation2("c"));
|
| + _assertCloneUnitMember('class C { C() : super.c(); }');
|
| }
|
|
|
| void test_visitSuperExpression() {
|
| - _assertClone(AstFactory.superExpression());
|
| + _assertCloneUnitMember('class C { m() { super.m(); } }');
|
| }
|
|
|
| void test_visitSwitchCase_multipleLabels() {
|
| - _assertClone(AstFactory.switchCase2(
|
| - [AstFactory.label2("l1"), AstFactory.label2("l2")],
|
| - AstFactory.identifier3("a"),
|
| - [AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) {l1: l2: case a: {} }');
|
| }
|
|
|
| void test_visitSwitchCase_multipleStatements() {
|
| - _assertClone(AstFactory.switchCase(
|
| - AstFactory.identifier3("a"), [AstFactory.block(), AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { case a: {} {} }');
|
| }
|
|
|
| void test_visitSwitchCase_noLabels() {
|
| - _assertClone(AstFactory.switchCase(
|
| - AstFactory.identifier3("a"), [AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { case a: {} }');
|
| }
|
|
|
| void test_visitSwitchCase_singleLabel() {
|
| - _assertClone(AstFactory.switchCase2([AstFactory.label2("l1")],
|
| - AstFactory.identifier3("a"), [AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { l1: case a: {} }');
|
| }
|
|
|
| void test_visitSwitchDefault_multipleLabels() {
|
| - _assertClone(AstFactory.switchDefault(
|
| - [AstFactory.label2("l1"), AstFactory.label2("l2")],
|
| - [AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { l1: l2: default: {} }');
|
| }
|
|
|
| void test_visitSwitchDefault_multipleStatements() {
|
| - _assertClone(
|
| - AstFactory.switchDefault2([AstFactory.block(), AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { default: {} {} }');
|
| }
|
|
|
| void test_visitSwitchDefault_noLabels() {
|
| - _assertClone(AstFactory.switchDefault2([AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { default: {} }');
|
| }
|
|
|
| void test_visitSwitchDefault_singleLabel() {
|
| - _assertClone(AstFactory.switchDefault(
|
| - [AstFactory.label2("l1")], [AstFactory.block()]));
|
| + _assertCloneStatement('switch (v) { l1: default: {} }');
|
| }
|
|
|
| void test_visitSwitchStatement() {
|
| - _assertClone(AstFactory.switchStatement(AstFactory.identifier3("a"), [
|
| - AstFactory.switchCase(AstFactory.string2("b"), [AstFactory.block()]),
|
| - AstFactory.switchDefault2([AstFactory.block()])
|
| - ]));
|
| + _assertCloneStatement('switch (a) { case b: {} default: {} }');
|
| }
|
|
|
| void test_visitSymbolLiteral_multiple() {
|
| - _assertClone(AstFactory.symbolLiteral(["a", "b", "c"]));
|
| + _assertCloneExpression('#a.b.c');
|
| }
|
|
|
| void test_visitSymbolLiteral_single() {
|
| - _assertClone(AstFactory.symbolLiteral(["a"]));
|
| + _assertCloneExpression('#a');
|
| }
|
|
|
| void test_visitThisExpression() {
|
| - _assertClone(AstFactory.thisExpression());
|
| + _assertCloneExpression('this');
|
| }
|
|
|
| void test_visitThrowStatement() {
|
| - _assertClone(AstFactory.throwExpression2(AstFactory.identifier3("e")));
|
| + _assertCloneStatement('throw e;');
|
| }
|
|
|
| void test_visitTopLevelVariableDeclaration_multiple() {
|
| - _assertClone(AstFactory.topLevelVariableDeclaration2(
|
| - Keyword.VAR, [AstFactory.variableDeclaration("a")]));
|
| + _assertCloneUnitMember('var a;');
|
| }
|
|
|
| void test_visitTopLevelVariableDeclaration_single() {
|
| - _assertClone(AstFactory.topLevelVariableDeclaration2(Keyword.VAR, [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]));
|
| + _assertCloneUnitMember('var a, b;');
|
| }
|
|
|
| void test_visitTryStatement_catch() {
|
| - _assertClone(AstFactory.tryStatement2(AstFactory.block(),
|
| - [AstFactory.catchClause3(AstFactory.typeName4("E"))]));
|
| + _assertCloneStatement('try {} on E {}');
|
| }
|
|
|
| void test_visitTryStatement_catches() {
|
| - _assertClone(AstFactory.tryStatement2(AstFactory.block(), [
|
| - AstFactory.catchClause3(AstFactory.typeName4("E")),
|
| - AstFactory.catchClause3(AstFactory.typeName4("F"))
|
| - ]));
|
| + _assertCloneStatement('try {} on E {} on F {}');
|
| }
|
|
|
| void test_visitTryStatement_catchFinally() {
|
| - _assertClone(AstFactory.tryStatement3(
|
| - AstFactory.block(),
|
| - [AstFactory.catchClause3(AstFactory.typeName4("E"))],
|
| - AstFactory.block()));
|
| + _assertCloneStatement('try {} on E {} finally {}');
|
| }
|
|
|
| void test_visitTryStatement_finally() {
|
| - _assertClone(
|
| - AstFactory.tryStatement(AstFactory.block(), AstFactory.block()));
|
| - }
|
| -
|
| - void test_visitTypeArgumentList_multiple() {
|
| - _assertClone(AstFactory.typeArgumentList(
|
| - [AstFactory.typeName4("E"), AstFactory.typeName4("F")]));
|
| - }
|
| -
|
| - void test_visitTypeArgumentList_single() {
|
| - _assertClone(AstFactory.typeArgumentList([AstFactory.typeName4("E")]));
|
| + _assertCloneStatement('try {} finally {}');
|
| }
|
|
|
| void test_visitTypeName_multipleArgs() {
|
| - _assertClone(AstFactory.typeName4(
|
| - "C", [AstFactory.typeName4("D"), AstFactory.typeName4("E")]));
|
| + _assertCloneExpression('new C<D, E>()');
|
| }
|
|
|
| void test_visitTypeName_nestedArg() {
|
| - _assertClone(AstFactory.typeName4("C", [
|
| - AstFactory.typeName4("D", [AstFactory.typeName4("E")])
|
| - ]));
|
| + _assertCloneExpression('new C<D<E>>()');
|
| }
|
|
|
| void test_visitTypeName_noArgs() {
|
| - _assertClone(AstFactory.typeName4("C"));
|
| + _assertCloneExpression('new C()');
|
| }
|
|
|
| void test_visitTypeName_singleArg() {
|
| - _assertClone(AstFactory.typeName4("C", [AstFactory.typeName4("D")]));
|
| + _assertCloneExpression('new C<D>()');
|
| }
|
|
|
| void test_visitTypeParameter_withExtends() {
|
| - _assertClone(AstFactory.typeParameter2("E", AstFactory.typeName4("C")));
|
| + _assertCloneUnitMember('class A<E extends C> {}');
|
| }
|
|
|
| void test_visitTypeParameter_withMetadata() {
|
| - TypeParameter parameter = AstFactory.typeParameter("E");
|
| - parameter.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(parameter);
|
| + _assertCloneUnitMember('class A<@deprecated E> {}');
|
| }
|
|
|
| void test_visitTypeParameter_withoutExtends() {
|
| - _assertClone(AstFactory.typeParameter("E"));
|
| + _assertCloneUnitMember('class A<E> {}');
|
| }
|
|
|
| void test_visitTypeParameterList_multiple() {
|
| - _assertClone(AstFactory.typeParameterList(["E", "F"]));
|
| + _assertCloneUnitMember('class A<E, F> {}');
|
| }
|
|
|
| void test_visitTypeParameterList_single() {
|
| - _assertClone(AstFactory.typeParameterList(["E"]));
|
| + _assertCloneUnitMember('class A<E> {}');
|
| }
|
|
|
| void test_visitVariableDeclaration_initialized() {
|
| - _assertClone(
|
| - AstFactory.variableDeclaration2("a", AstFactory.identifier3("b")));
|
| + _assertCloneStatement('var a = b;');
|
| }
|
|
|
| void test_visitVariableDeclaration_uninitialized() {
|
| - _assertClone(AstFactory.variableDeclaration("a"));
|
| + _assertCloneStatement('var a;');
|
| }
|
|
|
| void test_visitVariableDeclarationList_const_type() {
|
| - _assertClone(AstFactory.variableDeclarationList(
|
| - Keyword.CONST, AstFactory.typeName4("C"), [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]));
|
| + _assertCloneStatement('const C a, b;');
|
| }
|
|
|
| void test_visitVariableDeclarationList_final_noType() {
|
| - _assertClone(AstFactory.variableDeclarationList2(Keyword.FINAL, [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]));
|
| + _assertCloneStatement('final a, b;');
|
| }
|
|
|
| void test_visitVariableDeclarationList_final_withMetadata() {
|
| - VariableDeclarationList declarationList = AstFactory
|
| - .variableDeclarationList2(Keyword.FINAL, [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]);
|
| - declarationList.metadata
|
| - .add(AstFactory.annotation(AstFactory.identifier3("deprecated")));
|
| - _assertClone(declarationList);
|
| + _assertCloneStatement('@deprecated final a, b;');
|
| }
|
|
|
| void test_visitVariableDeclarationList_type() {
|
| - _assertClone(AstFactory.variableDeclarationList(
|
| - null, AstFactory.typeName4("C"), [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]));
|
| + _assertCloneStatement('C a, b;');
|
| }
|
|
|
| void test_visitVariableDeclarationList_var() {
|
| - _assertClone(AstFactory.variableDeclarationList2(Keyword.VAR, [
|
| - AstFactory.variableDeclaration("a"),
|
| - AstFactory.variableDeclaration("b")
|
| - ]));
|
| + _assertCloneStatement('var a, b;');
|
| }
|
|
|
| void test_visitVariableDeclarationStatement() {
|
| - _assertClone(AstFactory.variableDeclarationStatement(null,
|
| - AstFactory.typeName4("C"), [AstFactory.variableDeclaration("c")]));
|
| + _assertCloneStatement('C c;');
|
| }
|
|
|
| void test_visitWhileStatement() {
|
| - _assertClone(AstFactory.whileStatement(
|
| - AstFactory.identifier3("c"), AstFactory.block()));
|
| + _assertCloneStatement('while (c) {}');
|
| }
|
|
|
| void test_visitWithClause_multiple() {
|
| - _assertClone(AstFactory.withClause([
|
| - AstFactory.typeName4("A"),
|
| - AstFactory.typeName4("B"),
|
| - AstFactory.typeName4("C")
|
| - ]));
|
| + _assertCloneUnitMember('class X extends Y with A, B, C {}');
|
| }
|
|
|
| void test_visitWithClause_single() {
|
| - _assertClone(AstFactory.withClause([AstFactory.typeName4("A")]));
|
| + _assertCloneUnitMember('class X extends Y with A {}');
|
| }
|
|
|
| void test_visitYieldStatement() {
|
| - _assertClone(AstFactory.yieldStatement(AstFactory.identifier3("A")));
|
| + _assertCloneUnitMember('main() async* { yield 42; }');
|
| }
|
|
|
| /**
|
| @@ -1729,16 +1128,143 @@ class AstClonerTest extends EngineTestCase {
|
| * @throws AFE if the visitor does not produce the expected source for the given node
|
| */
|
| void _assertClone(AstNode node) {
|
| - AstNode clone = node.accept(new AstCloner());
|
| - AstCloneComparator comparitor = new AstCloneComparator(false);
|
| - if (!comparitor.isEqualNodes(node, clone)) {
|
| - fail("Failed to clone ${node.runtimeType.toString()}");
|
| + {
|
| + AstNode clone = node.accept(new AstCloner());
|
| + AstCloneComparator comparator = new AstCloneComparator(false);
|
| + if (!comparator.isEqualNodes(node, clone)) {
|
| + fail("Failed to clone ${node.runtimeType.toString()}");
|
| + }
|
| + _assertEqualTokens(clone, node);
|
| }
|
| + {
|
| + AstNode clone = node.accept(new AstCloner(true));
|
| + AstCloneComparator comparator = new AstCloneComparator(true);
|
| + if (!comparator.isEqualNodes(node, clone)) {
|
| + fail("Failed to clone ${node.runtimeType.toString()}");
|
| + }
|
| + _assertEqualTokens(clone, node);
|
| + }
|
| + }
|
| +
|
| + void _assertCloneExpression(String code) {
|
| + AstNode node = _parseExpression(code);
|
| + _assertClone(node);
|
| + }
|
| +
|
| + void _assertCloneStatement(String code) {
|
| + AstNode node = _parseStatement(code);
|
| + _assertClone(node);
|
| + }
|
| +
|
| + void _assertCloneUnit(String code) {
|
| + AstNode node = _parseUnit(code);
|
| + _assertClone(node);
|
| + }
|
| +
|
| + void _assertCloneUnitMember(String code) {
|
| + AstNode node = _parseUnitMember(code);
|
| + _assertClone(node);
|
| + }
|
| +
|
| + Expression _parseExpression(String code) {
|
| + CompilationUnit unit = _parseUnit('var v = $code;');
|
| + TopLevelVariableDeclaration decl = unit.declarations.single;
|
| + return decl.variables.variables.single.initializer;
|
| + }
|
| +
|
| + Statement _parseStatement(String code) {
|
| + CompilationUnit unit = _parseUnit('main() { $code }');
|
| + FunctionDeclaration main = unit.declarations.single;
|
| + BlockFunctionBody body = main.functionExpression.body;
|
| + return body.block.statements.single;
|
| + }
|
| +
|
| + CompilationUnit _parseUnit(String code) {
|
| + GatheringErrorListener listener = new GatheringErrorListener();
|
| + CharSequenceReader reader = new CharSequenceReader(code);
|
| + Scanner scanner = new Scanner(null, reader, listener);
|
| + Token token = scanner.tokenize();
|
| + Parser parser = new Parser(null, listener);
|
| + CompilationUnit unit = parser.parseCompilationUnit(token);
|
| + expect(unit, isNotNull);
|
| + listener.assertNoErrors();
|
| + return unit;
|
| + }
|
| +
|
| + CompilationUnitMember _parseUnitMember(String code) {
|
| + CompilationUnit unit = _parseUnit(code);
|
| + return unit.declarations.single;
|
| + }
|
| +
|
| + static void _assertEqualToken(Token clone, Token original) {
|
| + expect(clone.type, original.type);
|
| + expect(clone.offset, original.offset);
|
| + expect(clone.length, original.length);
|
| + expect(clone.lexeme, original.lexeme);
|
| + }
|
|
|
| - clone = node.accept(new AstCloner(true));
|
| - comparitor = new AstCloneComparator(true);
|
| - if (!comparitor.isEqualNodes(node, clone)) {
|
| - fail("Failed to clone ${node.runtimeType.toString()}");
|
| + static void _assertEqualTokens(AstNode cloneNode, AstNode originalNode) {
|
| + Token clone = cloneNode.beginToken;
|
| + Token original = originalNode.beginToken;
|
| + if (original is! CommentToken) {
|
| + _assertHasPrevious(original);
|
| + _assertHasPrevious(clone);
|
| + }
|
| + Token stopOriginalToken = originalNode.endToken.next;
|
| + Token skipCloneComment = null;
|
| + Token skipOriginalComment = null;
|
| + while (original != stopOriginalToken) {
|
| + expect(clone, isNotNull);
|
| + _assertEqualToken(clone, original);
|
| + // comments
|
| + {
|
| + Token cloneComment = clone.precedingComments;
|
| + Token originalComment = original.precedingComments;
|
| + if (cloneComment != skipCloneComment &&
|
| + originalComment != skipOriginalComment) {
|
| + while (true) {
|
| + if (originalComment == null) {
|
| + expect(cloneComment, isNull);
|
| + break;
|
| + }
|
| + expect(cloneComment, isNotNull);
|
| + _assertEqualToken(cloneComment, originalComment);
|
| + cloneComment = cloneComment.next;
|
| + originalComment = originalComment.next;
|
| + }
|
| + }
|
| + }
|
| + // next tokens
|
| + if (original is CommentToken) {
|
| + expect(clone, new isInstanceOf<CommentToken>());
|
| + skipOriginalComment = original;
|
| + skipCloneComment = clone;
|
| + original = (original as CommentToken).parent;
|
| + clone = (clone as CommentToken).parent;
|
| + } else {
|
| + clone = clone.next;
|
| + original = original.next;
|
| + }
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * Assert that the [token] has `previous` set, and if it `EOF`, then it
|
| + * points itself.
|
| + */
|
| + static void _assertHasPrevious(Token token) {
|
| + expect(token, isNotNull);
|
| + if (token.type == TokenType.EOF) {
|
| + return;
|
| + }
|
| + while (token != null) {
|
| + Token previous = token.previous;
|
| + expect(previous, isNotNull);
|
| + if (token.type == TokenType.EOF) {
|
| + expect(previous, same(token));
|
| + break;
|
| + }
|
| + token = previous;
|
| }
|
| }
|
| }
|
| @@ -1928,12 +1454,7 @@ class DirectedGraphTest extends EngineTestCase {
|
| void test_findCycleContaining_null() {
|
| DirectedGraph<DirectedGraphTest_Node> graph =
|
| new DirectedGraph<DirectedGraphTest_Node>();
|
| - try {
|
| - graph.findCycleContaining(null);
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + expect(() => graph.findCycleContaining(null), throwsArgumentError);
|
| }
|
|
|
| void test_findCycleContaining_singleton() {
|
| @@ -2074,880 +1595,918 @@ class DirectedGraphTest extends EngineTestCase {
|
| class DirectedGraphTest_Node {}
|
|
|
| class Getter_NodeReplacerTest_test_annotation
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<Annotation, ArgumentList> {
|
| @override
|
| ArgumentList get(Annotation node) => node.arguments;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_annotation_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<Annotation, Identifier> {
|
| @override
|
| Identifier get(Annotation node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_annotation_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<Annotation, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(Annotation node) => node.constructorName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_asExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AsExpression, TypeName> {
|
| @override
|
| TypeName get(AsExpression node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_asExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AsExpression, Expression> {
|
| @override
|
| Expression get(AsExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_assertStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AssertStatement, Expression> {
|
| @override
|
| Expression get(AssertStatement node) => node.condition;
|
| }
|
|
|
| +class Getter_NodeReplacerTest_test_assertStatement_2
|
| + implements NodeReplacerTest_Getter<AssertStatement, Expression> {
|
| + @override
|
| + Expression get(AssertStatement node) => node.message;
|
| +}
|
| +
|
| class Getter_NodeReplacerTest_test_assignmentExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AssignmentExpression, Expression> {
|
| @override
|
| Expression get(AssignmentExpression node) => node.rightHandSide;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_assignmentExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AssignmentExpression, Expression> {
|
| @override
|
| Expression get(AssignmentExpression node) => node.leftHandSide;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_awaitExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AwaitExpression, Expression> {
|
| @override
|
| Expression get(AwaitExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_binaryExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<BinaryExpression, Expression> {
|
| @override
|
| Expression get(BinaryExpression node) => node.leftOperand;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_binaryExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<BinaryExpression, Expression> {
|
| @override
|
| Expression get(BinaryExpression node) => node.rightOperand;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_blockFunctionBody
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<BlockFunctionBody, Block> {
|
| @override
|
| Block get(BlockFunctionBody node) => node.block;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_breakStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<BreakStatement, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(BreakStatement node) => node.label;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_cascadeExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CascadeExpression, Expression> {
|
| @override
|
| Expression get(CascadeExpression node) => node.target;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_catchClause
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CatchClause, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(CatchClause node) => node.stackTraceParameter;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_catchClause_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CatchClause, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(CatchClause node) => node.exceptionParameter;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_catchClause_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CatchClause, TypeName> {
|
| @override
|
| TypeName get(CatchClause node) => node.exceptionType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, ImplementsClause> {
|
| @override
|
| ImplementsClause get(ClassDeclaration node) => node.implementsClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, WithClause> {
|
| @override
|
| WithClause get(ClassDeclaration node) => node.withClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, NativeClause> {
|
| @override
|
| NativeClause get(ClassDeclaration node) => node.nativeClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration_4
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, ExtendsClause> {
|
| @override
|
| ExtendsClause get(ClassDeclaration node) => node.extendsClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration_5
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, TypeParameterList> {
|
| @override
|
| TypeParameterList get(ClassDeclaration node) => node.typeParameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classDeclaration_6
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ClassDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classTypeAlias
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassTypeAlias, TypeName> {
|
| @override
|
| TypeName get(ClassTypeAlias node) => node.superclass;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classTypeAlias_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassTypeAlias, ImplementsClause> {
|
| @override
|
| ImplementsClause get(ClassTypeAlias node) => node.implementsClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classTypeAlias_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassTypeAlias, WithClause> {
|
| @override
|
| WithClause get(ClassTypeAlias node) => node.withClause;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classTypeAlias_4
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassTypeAlias, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ClassTypeAlias node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_classTypeAlias_5
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ClassTypeAlias, TypeParameterList> {
|
| @override
|
| TypeParameterList get(ClassTypeAlias node) => node.typeParameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_commentReference
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CommentReference, Identifier> {
|
| @override
|
| Identifier get(CommentReference node) => node.identifier;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_compilationUnit
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<CompilationUnit, ScriptTag> {
|
| @override
|
| ScriptTag get(CompilationUnit node) => node.scriptTag;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_conditionalExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConditionalExpression, Expression> {
|
| @override
|
| Expression get(ConditionalExpression node) => node.elseExpression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_conditionalExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConditionalExpression, Expression> {
|
| @override
|
| Expression get(ConditionalExpression node) => node.thenExpression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_conditionalExpression_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConditionalExpression, Expression> {
|
| @override
|
| Expression get(ConditionalExpression node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<ConstructorDeclaration, ConstructorName> {
|
| @override
|
| ConstructorName get(ConstructorDeclaration node) =>
|
| node.redirectedConstructor;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorDeclaration_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<ConstructorDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ConstructorDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorDeclaration_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConstructorDeclaration, Identifier> {
|
| @override
|
| Identifier get(ConstructorDeclaration node) => node.returnType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorDeclaration_4
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<ConstructorDeclaration, FormalParameterList> {
|
| @override
|
| FormalParameterList get(ConstructorDeclaration node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorDeclaration_5
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConstructorDeclaration, FunctionBody> {
|
| @override
|
| FunctionBody get(ConstructorDeclaration node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorFieldInitializer
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<ConstructorFieldInitializer, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ConstructorFieldInitializer node) => node.fieldName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorFieldInitializer_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<ConstructorFieldInitializer, Expression> {
|
| @override
|
| Expression get(ConstructorFieldInitializer node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorName
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConstructorName, TypeName> {
|
| @override
|
| TypeName get(ConstructorName node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_constructorName_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ConstructorName, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ConstructorName node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_continueStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ContinueStatement, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ContinueStatement node) => node.label;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_declaredIdentifier
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<DeclaredIdentifier, TypeName> {
|
| @override
|
| TypeName get(DeclaredIdentifier node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_declaredIdentifier_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<DeclaredIdentifier, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(DeclaredIdentifier node) => node.identifier;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_defaultFormalParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<DefaultFormalParameter, NormalFormalParameter> {
|
| @override
|
| NormalFormalParameter get(DefaultFormalParameter node) => node.parameter;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_defaultFormalParameter_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<DefaultFormalParameter, Expression> {
|
| @override
|
| Expression get(DefaultFormalParameter node) => node.defaultValue;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_doStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<DoStatement, Expression> {
|
| @override
|
| Expression get(DoStatement node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_doStatement_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<DoStatement, Statement> {
|
| @override
|
| Statement get(DoStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_enumConstantDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<EnumConstantDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(EnumConstantDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_enumDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<EnumDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(EnumDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_expressionFunctionBody
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ExpressionFunctionBody, Expression> {
|
| @override
|
| Expression get(ExpressionFunctionBody node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_expressionStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ExpressionStatement, Expression> {
|
| @override
|
| Expression get(ExpressionStatement node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_extendsClause
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ExtendsClause, TypeName> {
|
| @override
|
| TypeName get(ExtendsClause node) => node.superclass;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_fieldDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FieldDeclaration, VariableDeclarationList> {
|
| @override
|
| VariableDeclarationList get(FieldDeclaration node) => node.fields;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_fieldFormalParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FieldFormalParameter, FormalParameterList> {
|
| @override
|
| FormalParameterList get(FieldFormalParameter node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_fieldFormalParameter_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FieldFormalParameter, TypeName> {
|
| @override
|
| TypeName get(FieldFormalParameter node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, Statement> {
|
| @override
|
| Statement get(ForEachStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ForEachStatement node) => node.identifier;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, Expression> {
|
| @override
|
| Expression get(ForEachStatement node) => node.iterable;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, Expression> {
|
| @override
|
| Expression get(ForEachStatement node) => node.iterable;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, DeclaredIdentifier> {
|
| @override
|
| DeclaredIdentifier get(ForEachStatement node) => node.loopVariable;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forEachStatement_withLoopVariable_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForEachStatement, Statement> {
|
| @override
|
| Statement get(ForEachStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withInitialization
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, Statement> {
|
| @override
|
| Statement get(ForStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withInitialization_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, Expression> {
|
| @override
|
| Expression get(ForStatement node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withInitialization_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, Expression> {
|
| @override
|
| Expression get(ForStatement node) => node.initialization;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withVariables
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, Statement> {
|
| @override
|
| Statement get(ForStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withVariables_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, VariableDeclarationList> {
|
| @override
|
| VariableDeclarationList get(ForStatement node) => node.variables;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_forStatement_withVariables_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ForStatement, Expression> {
|
| @override
|
| Expression get(ForStatement node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionDeclaration, TypeName> {
|
| @override
|
| TypeName get(FunctionDeclaration node) => node.returnType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionDeclaration_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionDeclaration, FunctionExpression> {
|
| @override
|
| FunctionExpression get(FunctionDeclaration node) => node.functionExpression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionDeclaration_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(FunctionDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionDeclarationStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionDeclarationStatement,
|
| + FunctionDeclaration> {
|
| @override
|
| FunctionDeclaration get(FunctionDeclarationStatement node) =>
|
| node.functionDeclaration;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionExpression, FormalParameterList> {
|
| @override
|
| FormalParameterList get(FunctionExpression node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionExpression, FunctionBody> {
|
| @override
|
| FunctionBody get(FunctionExpression node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionExpressionInvocation
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionExpressionInvocation, Expression> {
|
| @override
|
| Expression get(FunctionExpressionInvocation node) => node.function;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionExpressionInvocation_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionExpressionInvocation, ArgumentList> {
|
| @override
|
| ArgumentList get(FunctionExpressionInvocation node) => node.argumentList;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypeAlias
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeParameterList> {
|
| @override
|
| TypeParameterList get(FunctionTypeAlias node) => node.typeParameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypeAlias_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionTypeAlias, FormalParameterList> {
|
| @override
|
| FormalParameterList get(FunctionTypeAlias node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypeAlias_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeName> {
|
| @override
|
| TypeName get(FunctionTypeAlias node) => node.returnType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypeAlias_4
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionTypeAlias, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(FunctionTypeAlias node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypedFormalParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<FunctionTypedFormalParameter, TypeName> {
|
| @override
|
| TypeName get(FunctionTypedFormalParameter node) => node.returnType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_functionTypedFormalParameter_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<FunctionTypedFormalParameter,
|
| + FormalParameterList> {
|
| @override
|
| FormalParameterList get(FunctionTypedFormalParameter node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_ifStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IfStatement, Expression> {
|
| @override
|
| Expression get(IfStatement node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_ifStatement_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IfStatement, Statement> {
|
| @override
|
| Statement get(IfStatement node) => node.elseStatement;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_ifStatement_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IfStatement, Statement> {
|
| @override
|
| Statement get(IfStatement node) => node.thenStatement;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_importDirective
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ImportDirective, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(ImportDirective node) => node.prefix;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_indexExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IndexExpression, Expression> {
|
| @override
|
| Expression get(IndexExpression node) => node.target;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_indexExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IndexExpression, Expression> {
|
| @override
|
| Expression get(IndexExpression node) => node.index;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_instanceCreationExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<InstanceCreationExpression, ArgumentList> {
|
| @override
|
| ArgumentList get(InstanceCreationExpression node) => node.argumentList;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_instanceCreationExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<InstanceCreationExpression, ConstructorName> {
|
| @override
|
| ConstructorName get(InstanceCreationExpression node) => node.constructorName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_interpolationExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<InterpolationExpression, Expression> {
|
| @override
|
| Expression get(InterpolationExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_isExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IsExpression, Expression> {
|
| @override
|
| Expression get(IsExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_isExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<IsExpression, TypeName> {
|
| @override
|
| TypeName get(IsExpression node) => node.type;
|
| }
|
|
|
| -class Getter_NodeReplacerTest_test_label implements NodeReplacerTest_Getter {
|
| +class Getter_NodeReplacerTest_test_label
|
| + implements NodeReplacerTest_Getter<Label, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(Label node) => node.label;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_labeledStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<LabeledStatement, Statement> {
|
| @override
|
| Statement get(LabeledStatement node) => node.statement;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_libraryDirective
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<LibraryDirective, LibraryIdentifier> {
|
| @override
|
| LibraryIdentifier get(LibraryDirective node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_mapLiteralEntry
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MapLiteralEntry, Expression> {
|
| @override
|
| Expression get(MapLiteralEntry node) => node.value;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_mapLiteralEntry_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MapLiteralEntry, Expression> {
|
| @override
|
| Expression get(MapLiteralEntry node) => node.key;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodDeclaration, TypeName> {
|
| @override
|
| TypeName get(MethodDeclaration node) => node.returnType;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodDeclaration_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodDeclaration, FunctionBody> {
|
| @override
|
| FunctionBody get(MethodDeclaration node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodDeclaration_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(MethodDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodDeclaration_4
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodDeclaration, FormalParameterList> {
|
| @override
|
| FormalParameterList get(MethodDeclaration node) => node.parameters;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodInvocation
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodInvocation, ArgumentList> {
|
| @override
|
| ArgumentList get(MethodInvocation node) => node.argumentList;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodInvocation_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodInvocation, Expression> {
|
| @override
|
| Expression get(MethodInvocation node) => node.target;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_methodInvocation_3
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<MethodInvocation, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(MethodInvocation node) => node.methodName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_namedExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<NamedExpression, Label> {
|
| @override
|
| Label get(NamedExpression node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_namedExpression_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<NamedExpression, Expression> {
|
| @override
|
| Expression get(NamedExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_nativeClause
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<NativeClause, StringLiteral> {
|
| @override
|
| StringLiteral get(NativeClause node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_nativeFunctionBody
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<NativeFunctionBody, StringLiteral> {
|
| @override
|
| StringLiteral get(NativeFunctionBody node) => node.stringLiteral;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_parenthesizedExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ParenthesizedExpression, Expression> {
|
| @override
|
| Expression get(ParenthesizedExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_partOfDirective
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PartOfDirective, LibraryIdentifier> {
|
| @override
|
| LibraryIdentifier get(PartOfDirective node) => node.libraryName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_postfixExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PostfixExpression, Expression> {
|
| @override
|
| Expression get(PostfixExpression node) => node.operand;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_prefixedIdentifier
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PrefixedIdentifier, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(PrefixedIdentifier node) => node.identifier;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_prefixedIdentifier_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PrefixedIdentifier, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(PrefixedIdentifier node) => node.prefix;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_prefixExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PrefixExpression, Expression> {
|
| @override
|
| Expression get(PrefixExpression node) => node.operand;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_propertyAccess
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PropertyAccess, Expression> {
|
| @override
|
| Expression get(PropertyAccess node) => node.target;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_propertyAccess_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<PropertyAccess, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(PropertyAccess node) => node.propertyName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_redirectingConstructorInvocation
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<RedirectingConstructorInvocation,
|
| + SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(RedirectingConstructorInvocation node) =>
|
| node.constructorName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_redirectingConstructorInvocation_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<RedirectingConstructorInvocation,
|
| + ArgumentList> {
|
| @override
|
| ArgumentList get(RedirectingConstructorInvocation node) => node.argumentList;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_returnStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ReturnStatement, Expression> {
|
| @override
|
| Expression get(ReturnStatement node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_simpleFormalParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<SimpleFormalParameter, TypeName> {
|
| @override
|
| TypeName get(SimpleFormalParameter node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_superConstructorInvocation
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<SuperConstructorInvocation, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(SuperConstructorInvocation node) => node.constructorName;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_superConstructorInvocation_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<SuperConstructorInvocation, ArgumentList> {
|
| @override
|
| ArgumentList get(SuperConstructorInvocation node) => node.argumentList;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_switchCase
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<SwitchCase, Expression> {
|
| @override
|
| Expression get(SwitchCase node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_switchStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<SwitchStatement, Expression> {
|
| @override
|
| Expression get(SwitchStatement node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_throwExpression
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<ThrowExpression, Expression> {
|
| @override
|
| Expression get(ThrowExpression node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_topLevelVariableDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<TopLevelVariableDeclaration,
|
| + VariableDeclarationList> {
|
| @override
|
| VariableDeclarationList get(TopLevelVariableDeclaration node) =>
|
| node.variables;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_tryStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TryStatement, Block> {
|
| @override
|
| Block get(TryStatement node) => node.finallyBlock;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_tryStatement_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TryStatement, Block> {
|
| @override
|
| Block get(TryStatement node) => node.body;
|
| }
|
|
|
| -class Getter_NodeReplacerTest_test_typeName implements NodeReplacerTest_Getter {
|
| +class Getter_NodeReplacerTest_test_typeName
|
| + implements NodeReplacerTest_Getter<TypeName, TypeArgumentList> {
|
| @override
|
| TypeArgumentList get(TypeName node) => node.typeArguments;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_typeName_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TypeName, Identifier> {
|
| @override
|
| Identifier get(TypeName node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_typeParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TypeParameter, TypeName> {
|
| @override
|
| TypeName get(TypeParameter node) => node.bound;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_typeParameter_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TypeParameter, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(TypeParameter node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_variableDeclaration
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<VariableDeclaration, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(VariableDeclaration node) => node.name;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_variableDeclaration_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<VariableDeclaration, Expression> {
|
| @override
|
| Expression get(VariableDeclaration node) => node.initializer;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_variableDeclarationList
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<VariableDeclarationList, TypeName> {
|
| @override
|
| TypeName get(VariableDeclarationList node) => node.type;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_variableDeclarationStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<VariableDeclarationStatement,
|
| + VariableDeclarationList> {
|
| @override
|
| VariableDeclarationList get(VariableDeclarationStatement node) =>
|
| node.variables;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_whileStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<WhileStatement, Expression> {
|
| @override
|
| Expression get(WhileStatement node) => node.condition;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_whileStatement_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<WhileStatement, Statement> {
|
| @override
|
| Statement get(WhileStatement node) => node.body;
|
| }
|
|
|
| class Getter_NodeReplacerTest_test_yieldStatement
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<YieldStatement, Expression> {
|
| @override
|
| Expression get(YieldStatement node) => node.expression;
|
| }
|
|
|
| class Getter_NodeReplacerTest_testAnnotatedNode
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<AnnotatedNode, Comment> {
|
| @override
|
| Comment get(AnnotatedNode node) => node.documentationComment;
|
| }
|
|
|
| class Getter_NodeReplacerTest_testNormalFormalParameter
|
| - implements NodeReplacerTest_Getter {
|
| + implements
|
| + NodeReplacerTest_Getter<NormalFormalParameter, SimpleIdentifier> {
|
| @override
|
| SimpleIdentifier get(NormalFormalParameter node) => node.identifier;
|
| }
|
|
|
| class Getter_NodeReplacerTest_testNormalFormalParameter_2
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<NormalFormalParameter, Comment> {
|
| @override
|
| Comment get(NormalFormalParameter node) => node.documentationComment;
|
| }
|
|
|
| class Getter_NodeReplacerTest_testTypedLiteral
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<TypedLiteral, TypeArgumentList> {
|
| @override
|
| TypeArgumentList get(TypedLiteral node) => node.typeArguments;
|
| }
|
|
|
| class Getter_NodeReplacerTest_testUriBasedDirective
|
| - implements NodeReplacerTest_Getter {
|
| + implements NodeReplacerTest_Getter<UriBasedDirective, StringLiteral> {
|
| @override
|
| StringLiteral get(UriBasedDirective node) => node.uri;
|
| }
|
| @@ -2959,21 +2518,15 @@ class LineInfoTest {
|
| }
|
|
|
| void test_creation_empty() {
|
| - try {
|
| + expect(() {
|
| new LineInfo(<int>[]);
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + }, throwsArgumentError);
|
| }
|
|
|
| void test_creation_null() {
|
| - try {
|
| + expect(() {
|
| new LineInfo(null);
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + }, throwsArgumentError);
|
| }
|
|
|
| void test_firstLine() {
|
| @@ -3268,39 +2821,6 @@ class ListGetter_NodeReplacerTest_testSwitchMember_2
|
| NodeList<Statement> getList(SwitchMember node) => node.statements;
|
| }
|
|
|
| -@reflectiveTest
|
| -class ListUtilitiesTest {
|
| - void test_addAll_emptyToEmpty() {
|
| - List<String> list = new List<String>();
|
| - List<String> elements = <String>[];
|
| - ListUtilities.addAll(list, elements);
|
| - expect(list.length, 0);
|
| - }
|
| -
|
| - void test_addAll_emptyToNonEmpty() {
|
| - List<String> list = new List<String>();
|
| - list.add("a");
|
| - List<String> elements = <String>[];
|
| - ListUtilities.addAll(list, elements);
|
| - expect(list.length, 1);
|
| - }
|
| -
|
| - void test_addAll_nonEmptyToEmpty() {
|
| - List<String> list = new List<String>();
|
| - List<String> elements = ["b", "c"];
|
| - ListUtilities.addAll(list, elements);
|
| - expect(list.length, 2);
|
| - }
|
| -
|
| - void test_addAll_nonEmptyToNonEmpty() {
|
| - List<String> list = new List<String>();
|
| - list.add("a");
|
| - List<String> elements = ["b", "c"];
|
| - ListUtilities.addAll(list, elements);
|
| - expect(list.length, 3);
|
| - }
|
| -}
|
| -
|
| @reflectiveTest
|
| class MultipleMapIteratorTest extends EngineTestCase {
|
| void test_multipleMaps_firstEmpty() {
|
| @@ -3367,24 +2887,11 @@ class MultipleMapIteratorTest extends EngineTestCase {
|
| Map<String, String> map = new HashMap<String, String>();
|
| MultipleMapIterator<String, String> iterator = _iterator(<Map>[map]);
|
| expect(iterator.moveNext(), isFalse);
|
| - try {
|
| - iterator.key;
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| - try {
|
| - iterator.value;
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| - try {
|
| - iterator.value = "x";
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| + expect(() => iterator.key, throwsStateError);
|
| + expect(() => iterator.value, throwsStateError);
|
| + expect(() {
|
| + iterator.value = 'x';
|
| + }, throwsStateError);
|
| }
|
|
|
| void test_singleMap_multiple() {
|
| @@ -3460,9 +2967,10 @@ class NodeReplacerTest extends EngineTestCase {
|
| }
|
|
|
| void test_assertStatement() {
|
| - AssertStatement node =
|
| - AstFactory.assertStatement(AstFactory.booleanLiteral(true));
|
| + AssertStatement node = AstFactory.assertStatement(
|
| + AstFactory.booleanLiteral(true), AstFactory.string2('foo'));
|
| _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement());
|
| + _assertReplace(node, new Getter_NodeReplacerTest_test_assertStatement_2());
|
| }
|
|
|
| void test_assignmentExpression() {
|
| @@ -3527,8 +3035,8 @@ class NodeReplacerTest extends EngineTestCase {
|
| AstFactory.extendsClause(AstFactory.typeName4("B")),
|
| AstFactory.withClause([AstFactory.typeName4("C")]),
|
| AstFactory.implementsClause([AstFactory.typeName4("D")]), [
|
| - AstFactory.fieldDeclaration2(
|
| - false, null, [AstFactory.variableDeclaration("f")])
|
| + AstFactory
|
| + .fieldDeclaration2(false, null, [AstFactory.variableDeclaration("f")])
|
| ]);
|
| node.documentationComment =
|
| Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
| @@ -3974,8 +3482,8 @@ class NodeReplacerTest extends EngineTestCase {
|
| }
|
|
|
| void test_labeledStatement() {
|
| - LabeledStatement node = AstFactory.labeledStatement(
|
| - [AstFactory.label2("l")], AstFactory.block());
|
| + LabeledStatement node = AstFactory
|
| + .labeledStatement([AstFactory.label2("l")], AstFactory.block());
|
| _assertReplace(
|
| node, new ListGetter_NodeReplacerTest_test_labeledStatement(0));
|
| _assertReplace(node, new Getter_NodeReplacerTest_test_labeledStatement());
|
| @@ -4174,8 +3682,8 @@ class NodeReplacerTest extends EngineTestCase {
|
| }
|
|
|
| void test_switchDefault() {
|
| - SwitchDefault node = AstFactory.switchDefault(
|
| - [AstFactory.label2("l")], [AstFactory.block()]);
|
| + SwitchDefault node = AstFactory
|
| + .switchDefault([AstFactory.label2("l")], [AstFactory.block()]);
|
| _testSwitchMember(node);
|
| }
|
|
|
| @@ -4228,8 +3736,8 @@ class NodeReplacerTest extends EngineTestCase {
|
| }
|
|
|
| void test_typeName() {
|
| - TypeName node = AstFactory.typeName4(
|
| - "T", [AstFactory.typeName4("E"), AstFactory.typeName4("F")]);
|
| + TypeName node = AstFactory
|
| + .typeName4("T", [AstFactory.typeName4("E"), AstFactory.typeName4("F")]);
|
| _assertReplace(node, new Getter_NodeReplacerTest_test_typeName_2());
|
| _assertReplace(node, new Getter_NodeReplacerTest_test_typeName());
|
| }
|
| @@ -4263,10 +3771,14 @@ class NodeReplacerTest extends EngineTestCase {
|
| void test_variableDeclarationList() {
|
| VariableDeclarationList node = AstFactory.variableDeclarationList(
|
| null, AstFactory.typeName4("T"), [AstFactory.variableDeclaration("a")]);
|
| + node.documentationComment =
|
| + Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
|
| + node.metadata.add(AstFactory.annotation(AstFactory.identifier3("a")));
|
| _assertReplace(
|
| node, new Getter_NodeReplacerTest_test_variableDeclarationList());
|
| _assertReplace(
|
| node, new ListGetter_NodeReplacerTest_test_variableDeclarationList(0));
|
| + _testAnnotatedNode(node);
|
| }
|
|
|
| void test_variableDeclarationStatement() {
|
| @@ -4367,24 +3879,11 @@ class SingleMapIteratorTest extends EngineTestCase {
|
| SingleMapIterator<String, String> iterator =
|
| new SingleMapIterator<String, String>(map);
|
| expect(iterator.moveNext(), isFalse);
|
| - try {
|
| - iterator.key;
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| - try {
|
| - iterator.value;
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| - try {
|
| - iterator.value = "x";
|
| - fail("Expected NoSuchElementException");
|
| - } on NoSuchElementException {
|
| - // Expected
|
| - }
|
| + expect(() => iterator.key, throwsStateError);
|
| + expect(() => iterator.value, throwsStateError);
|
| + expect(() {
|
| + iterator.value = 'x';
|
| + }, throwsStateError);
|
| expect(iterator.moveNext(), isFalse);
|
| }
|
|
|
| @@ -4566,6 +4065,21 @@ class SourceRangeTest {
|
|
|
| @reflectiveTest
|
| class StringUtilitiesTest {
|
| + void test_computeLineStarts_n() {
|
| + List<int> starts = StringUtilities.computeLineStarts('a\nbb\nccc');
|
| + expect(starts, <int>[0, 2, 5]);
|
| + }
|
| +
|
| + void test_computeLineStarts_r() {
|
| + List<int> starts = StringUtilities.computeLineStarts('a\rbb\rccc');
|
| + expect(starts, <int>[0, 2, 5]);
|
| + }
|
| +
|
| + void test_computeLineStarts_rn() {
|
| + List<int> starts = StringUtilities.computeLineStarts('a\r\nbb\r\nccc');
|
| + expect(starts, <int>[0, 3, 7]);
|
| + }
|
| +
|
| void test_EMPTY() {
|
| expect(StringUtilities.EMPTY, "");
|
| expect(StringUtilities.EMPTY.isEmpty, isTrue);
|
| @@ -4662,12 +4176,9 @@ class StringUtilitiesTest {
|
| }
|
|
|
| void test_printListOfQuotedNames_empty() {
|
| - try {
|
| + expect(() {
|
| StringUtilities.printListOfQuotedNames(new List<String>(0));
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + }, throwsArgumentError);
|
| }
|
|
|
| void test_printListOfQuotedNames_five() {
|
| @@ -4678,21 +4189,15 @@ class StringUtilitiesTest {
|
| }
|
|
|
| void test_printListOfQuotedNames_null() {
|
| - try {
|
| + expect(() {
|
| StringUtilities.printListOfQuotedNames(null);
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + }, throwsArgumentError);
|
| }
|
|
|
| void test_printListOfQuotedNames_one() {
|
| - try {
|
| + expect(() {
|
| StringUtilities.printListOfQuotedNames(<String>["a"]);
|
| - fail("Expected IllegalArgumentException");
|
| - } on IllegalArgumentException {
|
| - // Expected
|
| - }
|
| + }, throwsArgumentError);
|
| }
|
|
|
| void test_printListOfQuotedNames_three() {
|
|
|