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

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

Issue 780763004: Annotate analyzer tests with @ReflectiveTestCase(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/generated/scanner_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.utilities_test; 8 library engine.utilities_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 @override 54 @override
55 bool isEqualTokens(Token first, Token second) { 55 bool isEqualTokens(Token first, Token second) {
56 if (expectTokensCopied && first != null && identical(first, second)) { 56 if (expectTokensCopied && first != null && identical(first, second)) {
57 fail('Failed to copy token: ${first.lexeme} (${first.offset})'); 57 fail('Failed to copy token: ${first.lexeme} (${first.offset})');
58 return false; 58 return false;
59 } 59 }
60 return super.isEqualTokens(first, second); 60 return super.isEqualTokens(first, second);
61 } 61 }
62 } 62 }
63 63
64 @ReflectiveTestCase()
64 class AstClonerTest extends EngineTestCase { 65 class AstClonerTest extends EngineTestCase {
65 void test_visitAdjacentStrings() { 66 void test_visitAdjacentStrings() {
66 _assertClone( 67 _assertClone(
67 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2( "b")])); 68 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2( "b")]));
68 } 69 }
69 70
70 void test_visitAnnotation_constant() { 71 void test_visitAnnotation_constant() {
71 _assertClone(AstFactory.annotation(AstFactory.identifier3("A"))); 72 _assertClone(AstFactory.annotation(AstFactory.identifier3("A")));
72 } 73 }
73 74
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 } 2046 }
2046 2047
2047 clone = node.accept(new AstCloner(true)); 2048 clone = node.accept(new AstCloner(true));
2048 comparitor = new AstCloneComparator(true); 2049 comparitor = new AstCloneComparator(true);
2049 if (!comparitor.isEqualNodes(node, clone)) { 2050 if (!comparitor.isEqualNodes(node, clone)) {
2050 fail("Failed to clone ${node.runtimeType.toString()}"); 2051 fail("Failed to clone ${node.runtimeType.toString()}");
2051 } 2052 }
2052 } 2053 }
2053 } 2054 }
2054 2055
2056 @ReflectiveTestCase()
2055 class BooleanArrayTest { 2057 class BooleanArrayTest {
2056 void test_get_negative() { 2058 void test_get_negative() {
2057 try { 2059 try {
2058 BooleanArray.get(0, -1); 2060 BooleanArray.get(0, -1);
2059 fail("Expected "); 2061 fail("Expected ");
2060 } on RangeError catch (exception) { 2062 } on RangeError catch (exception) {
2061 // Expected 2063 // Expected
2062 } 2064 }
2063 } 2065 }
2064 2066
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 } 2106 }
2105 2107
2106 void test_set_valuePreserving() { 2108 void test_set_valuePreserving() {
2107 expect(BooleanArray.set(0, 0, false), 0); 2109 expect(BooleanArray.set(0, 0, false), 0);
2108 expect(BooleanArray.set(1, 0, true), 1); 2110 expect(BooleanArray.set(1, 0, true), 1);
2109 expect(BooleanArray.set(0, 30, false), 0); 2111 expect(BooleanArray.set(0, 30, false), 0);
2110 expect(BooleanArray.set(1 << 30, 30, true), 1 << 30); 2112 expect(BooleanArray.set(1 << 30, 30, true), 1 << 30);
2111 } 2113 }
2112 } 2114 }
2113 2115
2116 @ReflectiveTestCase()
2114 class DirectedGraphTest extends EngineTestCase { 2117 class DirectedGraphTest extends EngineTestCase {
2115 void test_addEdge() { 2118 void test_addEdge() {
2116 DirectedGraph<DirectedGraphTest_Node> graph = 2119 DirectedGraph<DirectedGraphTest_Node> graph =
2117 new DirectedGraph<DirectedGraphTest_Node>(); 2120 new DirectedGraph<DirectedGraphTest_Node>();
2118 expect(graph.isEmpty, isTrue); 2121 expect(graph.isEmpty, isTrue);
2119 graph.addEdge(new DirectedGraphTest_Node(), new DirectedGraphTest_Node()); 2122 graph.addEdge(new DirectedGraphTest_Node(), new DirectedGraphTest_Node());
2120 expect(graph.isEmpty, isFalse); 2123 expect(graph.isEmpty, isFalse);
2121 } 2124 }
2122 2125
2123 void test_addNode() { 2126 void test_addNode() {
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3241 @override 3244 @override
3242 TypeArgumentList get(TypedLiteral node) => node.typeArguments; 3245 TypeArgumentList get(TypedLiteral node) => node.typeArguments;
3243 } 3246 }
3244 3247
3245 class Getter_NodeReplacerTest_testUriBasedDirective implements 3248 class Getter_NodeReplacerTest_testUriBasedDirective implements
3246 NodeReplacerTest_Getter { 3249 NodeReplacerTest_Getter {
3247 @override 3250 @override
3248 StringLiteral get(UriBasedDirective node) => node.uri; 3251 StringLiteral get(UriBasedDirective node) => node.uri;
3249 } 3252 }
3250 3253
3254 @ReflectiveTestCase()
3251 class LineInfoTest { 3255 class LineInfoTest {
3252 void test_creation() { 3256 void test_creation() {
3253 expect(new LineInfo(<int>[0]), isNotNull); 3257 expect(new LineInfo(<int>[0]), isNotNull);
3254 } 3258 }
3255 3259
3256 void test_creation_empty() { 3260 void test_creation_empty() {
3257 try { 3261 try {
3258 new LineInfo(<int>[]); 3262 new LineInfo(<int>[]);
3259 fail("Expected IllegalArgumentException"); 3263 fail("Expected IllegalArgumentException");
3260 } on IllegalArgumentException catch (exception) { 3264 } on IllegalArgumentException catch (exception) {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 } 3556 }
3553 3557
3554 class ListGetter_NodeReplacerTest_testSwitchMember_2 extends 3558 class ListGetter_NodeReplacerTest_testSwitchMember_2 extends
3555 NodeReplacerTest_ListGetter<SwitchMember, Statement> { 3559 NodeReplacerTest_ListGetter<SwitchMember, Statement> {
3556 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0); 3560 ListGetter_NodeReplacerTest_testSwitchMember_2(int arg0) : super(arg0);
3557 3561
3558 @override 3562 @override
3559 NodeList<Statement> getList(SwitchMember node) => node.statements; 3563 NodeList<Statement> getList(SwitchMember node) => node.statements;
3560 } 3564 }
3561 3565
3566 @ReflectiveTestCase()
3562 class ListUtilitiesTest { 3567 class ListUtilitiesTest {
3563 void test_addAll_emptyToEmpty() { 3568 void test_addAll_emptyToEmpty() {
3564 List<String> list = new List<String>(); 3569 List<String> list = new List<String>();
3565 List<String> elements = <String>[]; 3570 List<String> elements = <String>[];
3566 ListUtilities.addAll(list, elements); 3571 ListUtilities.addAll(list, elements);
3567 expect(list.length, 0); 3572 expect(list.length, 0);
3568 } 3573 }
3569 3574
3570 void test_addAll_emptyToNonEmpty() { 3575 void test_addAll_emptyToNonEmpty() {
3571 List<String> list = new List<String>(); 3576 List<String> list = new List<String>();
(...skipping 12 matching lines...) Expand all
3584 3589
3585 void test_addAll_nonEmptyToNonEmpty() { 3590 void test_addAll_nonEmptyToNonEmpty() {
3586 List<String> list = new List<String>(); 3591 List<String> list = new List<String>();
3587 list.add("a"); 3592 list.add("a");
3588 List<String> elements = ["b", "c"]; 3593 List<String> elements = ["b", "c"];
3589 ListUtilities.addAll(list, elements); 3594 ListUtilities.addAll(list, elements);
3590 expect(list.length, 3); 3595 expect(list.length, 3);
3591 } 3596 }
3592 } 3597 }
3593 3598
3599 @ReflectiveTestCase()
3594 class MultipleMapIteratorTest extends EngineTestCase { 3600 class MultipleMapIteratorTest extends EngineTestCase {
3595 void test_multipleMaps_firstEmpty() { 3601 void test_multipleMaps_firstEmpty() {
3596 Map<String, String> map1 = new HashMap<String, String>(); 3602 Map<String, String> map1 = new HashMap<String, String>();
3597 Map<String, String> map2 = new HashMap<String, String>(); 3603 Map<String, String> map2 = new HashMap<String, String>();
3598 map2["k2"] = "v2"; 3604 map2["k2"] = "v2";
3599 Map<String, String> map3 = new HashMap<String, String>(); 3605 Map<String, String> map3 = new HashMap<String, String>();
3600 map3["k3"] = "v3"; 3606 map3["k3"] = "v3";
3601 MultipleMapIterator<String, String> iterator = 3607 MultipleMapIterator<String, String> iterator =
3602 _iterator([map1, map2, map3]); 3608 _iterator([map1, map2, map3]);
3603 expect(iterator.moveNext(), isTrue); 3609 expect(iterator.moveNext(), isTrue);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 iterator.value = newValue; 3707 iterator.value = newValue;
3702 expect(iterator.value, same(newValue)); 3708 expect(iterator.value, same(newValue));
3703 expect(iterator.moveNext(), isFalse); 3709 expect(iterator.moveNext(), isFalse);
3704 } 3710 }
3705 3711
3706 MultipleMapIterator<String, String> _iterator(List<Map> maps) { 3712 MultipleMapIterator<String, String> _iterator(List<Map> maps) {
3707 return new MultipleMapIterator<String, String>(maps); 3713 return new MultipleMapIterator<String, String>(maps);
3708 } 3714 }
3709 } 3715 }
3710 3716
3717 @ReflectiveTestCase()
3711 class NodeReplacerTest extends EngineTestCase { 3718 class NodeReplacerTest extends EngineTestCase {
3712 /** 3719 /**
3713 * An empty list of tokens. 3720 * An empty list of tokens.
3714 */ 3721 */
3715 static const List<Token> EMPTY_TOKEN_LIST = const <Token>[]; 3722 static const List<Token> EMPTY_TOKEN_LIST = const <Token>[];
3716 3723
3717 void test_adjacentStrings() { 3724 void test_adjacentStrings() {
3718 AdjacentStrings node = 3725 AdjacentStrings node =
3719 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2( "b")]); 3726 AstFactory.adjacentStrings([AstFactory.string2("a"), AstFactory.string2( "b")]);
3720 _assertReplace( 3727 _assertReplace(
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 NodeList<C> list = getList(parent); 4757 NodeList<C> list = getList(parent);
4751 if (list.isEmpty) { 4758 if (list.isEmpty) {
4752 return null; 4759 return null;
4753 } 4760 }
4754 return list[_index]; 4761 return list[_index];
4755 } 4762 }
4756 4763
4757 NodeList<C> getList(P parent); 4764 NodeList<C> getList(P parent);
4758 } 4765 }
4759 4766
4767 @ReflectiveTestCase()
4760 class SingleMapIteratorTest extends EngineTestCase { 4768 class SingleMapIteratorTest extends EngineTestCase {
4761 void test_empty() { 4769 void test_empty() {
4762 Map<String, String> map = new HashMap<String, String>(); 4770 Map<String, String> map = new HashMap<String, String>();
4763 SingleMapIterator<String, String> iterator = 4771 SingleMapIterator<String, String> iterator =
4764 new SingleMapIterator<String, String>(map); 4772 new SingleMapIterator<String, String>(map);
4765 expect(iterator.moveNext(), isFalse); 4773 expect(iterator.moveNext(), isFalse);
4766 try { 4774 try {
4767 iterator.key; 4775 iterator.key;
4768 fail("Expected NoSuchElementException"); 4776 fail("Expected NoSuchElementException");
4769 } on NoSuchElementException catch (exception) { 4777 } on NoSuchElementException catch (exception) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4807 expect(iterator.moveNext(), isTrue); 4815 expect(iterator.moveNext(), isTrue);
4808 expect(iterator.key, same(key)); 4816 expect(iterator.key, same(key));
4809 expect(iterator.value, same(value)); 4817 expect(iterator.value, same(value));
4810 String newValue = "newValue"; 4818 String newValue = "newValue";
4811 iterator.value = newValue; 4819 iterator.value = newValue;
4812 expect(iterator.value, same(newValue)); 4820 expect(iterator.value, same(newValue));
4813 expect(iterator.moveNext(), isFalse); 4821 expect(iterator.moveNext(), isFalse);
4814 } 4822 }
4815 } 4823 }
4816 4824
4825 @ReflectiveTestCase()
4817 class SourceRangeTest { 4826 class SourceRangeTest {
4818 void test_access() { 4827 void test_access() {
4819 SourceRange r = new SourceRange(10, 1); 4828 SourceRange r = new SourceRange(10, 1);
4820 expect(r.offset, 10); 4829 expect(r.offset, 10);
4821 expect(r.length, 1); 4830 expect(r.length, 1);
4822 expect(r.end, 10 + 1); 4831 expect(r.end, 10 + 1);
4823 // to check 4832 // to check
4824 r.hashCode; 4833 r.hashCode;
4825 } 4834 }
4826 4835
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 expect(r.startsIn(new SourceRange(5, 1)), isTrue); 4965 expect(r.startsIn(new SourceRange(5, 1)), isTrue);
4957 expect(r.startsIn(new SourceRange(0, 20)), isTrue); 4966 expect(r.startsIn(new SourceRange(0, 20)), isTrue);
4958 } 4967 }
4959 4968
4960 void test_toString() { 4969 void test_toString() {
4961 SourceRange r = new SourceRange(10, 1); 4970 SourceRange r = new SourceRange(10, 1);
4962 expect(r.toString(), "[offset=10, length=1]"); 4971 expect(r.toString(), "[offset=10, length=1]");
4963 } 4972 }
4964 } 4973 }
4965 4974
4975 @ReflectiveTestCase()
4966 class StringUtilitiesTest { 4976 class StringUtilitiesTest {
4967 void test_EMPTY() { 4977 void test_EMPTY() {
4968 expect(StringUtilities.EMPTY, ""); 4978 expect(StringUtilities.EMPTY, "");
4969 expect(StringUtilities.EMPTY.isEmpty, isTrue); 4979 expect(StringUtilities.EMPTY.isEmpty, isTrue);
4970 } 4980 }
4971 4981
4972 void test_EMPTY_ARRAY() { 4982 void test_EMPTY_ARRAY() {
4973 expect(StringUtilities.EMPTY_ARRAY.length, 0); 4983 expect(StringUtilities.EMPTY_ARRAY.length, 0);
4974 } 4984 }
4975 4985
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 expect(StringUtilities.substringBeforeChar(null, 0x61), null); 5222 expect(StringUtilities.substringBeforeChar(null, 0x61), null);
5213 expect(StringUtilities.substringBeforeChar("", 0x61), ""); 5223 expect(StringUtilities.substringBeforeChar("", 0x61), "");
5214 expect(StringUtilities.substringBeforeChar("abc", 0x61), ""); 5224 expect(StringUtilities.substringBeforeChar("abc", 0x61), "");
5215 expect(StringUtilities.substringBeforeChar("abcba", 0x62), "a"); 5225 expect(StringUtilities.substringBeforeChar("abcba", 0x62), "a");
5216 expect(StringUtilities.substringBeforeChar("abc", 0x63), "ab"); 5226 expect(StringUtilities.substringBeforeChar("abc", 0x63), "ab");
5217 expect(StringUtilities.substringBeforeChar("abc", 0x64), "abc"); 5227 expect(StringUtilities.substringBeforeChar("abc", 0x64), "abc");
5218 } 5228 }
5219 } 5229 }
5220 5230
5221 5231
5232 @ReflectiveTestCase()
5222 class TokenMapTest { 5233 class TokenMapTest {
5223 void test_creation() { 5234 void test_creation() {
5224 expect(new TokenMap(), isNotNull); 5235 expect(new TokenMap(), isNotNull);
5225 } 5236 }
5226 5237
5227 void test_get_absent() { 5238 void test_get_absent() {
5228 TokenMap tokenMap = new TokenMap(); 5239 TokenMap tokenMap = new TokenMap();
5229 expect(tokenMap.get(TokenFactory.tokenFromType(TokenType.AT)), isNull); 5240 expect(tokenMap.get(TokenFactory.tokenFromType(TokenType.AT)), isNull);
5230 } 5241 }
5231 5242
5232 void test_get_added() { 5243 void test_get_added() {
5233 TokenMap tokenMap = new TokenMap(); 5244 TokenMap tokenMap = new TokenMap();
5234 Token key = TokenFactory.tokenFromType(TokenType.AT); 5245 Token key = TokenFactory.tokenFromType(TokenType.AT);
5235 Token value = TokenFactory.tokenFromType(TokenType.AT); 5246 Token value = TokenFactory.tokenFromType(TokenType.AT);
5236 tokenMap.put(key, value); 5247 tokenMap.put(key, value);
5237 expect(tokenMap.get(key), same(value)); 5248 expect(tokenMap.get(key), same(value));
5238 } 5249 }
5239 } 5250 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/scanner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698