| OLD | NEW |
| 1 // // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // // for details. All rights reserved. Use of this source code is governed by a | 2 // // for details. All rights reserved. Use of this source code is governed by a |
| 3 // // BSD-style license that can be found in the LICENSE file. | 3 // // BSD-style license that can be found in the LICENSE file. |
| 4 // // This code was auto-generated, is not intended to be edited, and is subject
to | 4 // // This code was auto-generated, is not intended to be edited, and is subject
to |
| 5 // // significant change. Please see the README file for more information. | 5 // // significant change. Please see the README file for more information. |
| 6 // library engine.engine_test; | 6 // library engine.engine_test; |
| 7 // import 'dart:collection'; | 7 // import 'dart:collection'; |
| 8 // import 'package:analyzer/src/generated/ast.dart'; | 8 // import 'package:analyzer/src/generated/ast.dart'; |
| 9 // import 'package:analyzer/src/generated/element.dart'; | 9 // import 'package:analyzer/src/generated/element.dart'; |
| 10 // import 'package:analyzer/src/generated/engine.dart'; | 10 // import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // class AnalysisCacheTest extends EngineTestCase { | 26 // class AnalysisCacheTest extends EngineTestCase { |
| 27 // void test_creation() { | 27 // void test_creation() { |
| 28 // JUnitTestCase.assertNotNull(new AnalysisCache(new List<CachePartition>(0)
)); | 28 // JUnitTestCase.assertNotNull(new AnalysisCache(new List<CachePartition>(0)
)); |
| 29 // } | 29 // } |
| 30 // void test_get() { | 30 // void test_get() { |
| 31 // AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); | 31 // AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); |
| 32 // TestSource source = new TestSource(); | 32 // TestSource source = new TestSource(); |
| 33 // JUnitTestCase.assertNull(cache.get(source)); | 33 // JUnitTestCase.assertNull(cache.get(source)); |
| 34 // } | 34 // } |
| 35 // void test_iterator() { | 35 // void test_iterator() { |
| 36 // CachePartition partition = new UniversalCachePartition(8, new DefaultRete
ntionPolicy()); | 36 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); |
| 37 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | 37 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 38 // TestSource source = new TestSource(); | 38 // TestSource source = new TestSource(); |
| 39 // DartEntryImpl entry = new DartEntryImpl(); | 39 // DartEntryImpl entry = new DartEntryImpl(); |
| 40 // cache.put(source, entry); | 40 // cache.put(source, entry); |
| 41 // MapIterator<Source, SourceEntry> iterator = cache.iterator(); | 41 // MapIterator<Source, SourceEntry> iterator = cache.iterator(); |
| 42 // JUnitTestCase.assertTrue(iterator.moveNext()); | 42 // JUnitTestCase.assertTrue(iterator.moveNext()); |
| 43 // JUnitTestCase.assertSame(source, iterator.key); | 43 // JUnitTestCase.assertSame(source, iterator.key); |
| 44 // JUnitTestCase.assertSame(entry, iterator.value); | 44 // JUnitTestCase.assertSame(entry, iterator.value); |
| 45 // JUnitTestCase.assertFalse(iterator.moveNext()); | 45 // JUnitTestCase.assertFalse(iterator.moveNext()); |
| 46 // } | 46 // } |
| 47 // void test_put_noFlush() { | 47 // void test_put_noFlush() { |
| 48 // CachePartition partition = new UniversalCachePartition(8, new DefaultRete
ntionPolicy()); | 48 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); |
| 49 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | 49 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 50 // TestSource source = new TestSource(); | 50 // TestSource source = new TestSource(); |
| 51 // DartEntryImpl entry = new DartEntryImpl(); | 51 // DartEntryImpl entry = new DartEntryImpl(); |
| 52 // cache.put(source, entry); | 52 // cache.put(source, entry); |
| 53 // JUnitTestCase.assertSame(entry, cache.get(source)); | 53 // JUnitTestCase.assertSame(entry, cache.get(source)); |
| 54 // } | 54 // } |
| 55 // void test_setMaxCacheSize() { | 55 // void test_setMaxCacheSize() { |
| 56 // CachePartition partition = new UniversalCachePartition(8, new CacheRetent
ionPolicy_AnalysisCacheTest_test_setMaxCacheSize()); | 56 // CachePartition partition = new UniversalCachePartition(null, 8, new Cache
RetentionPolicy_AnalysisCacheTest_test_setMaxCacheSize()); |
| 57 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | 57 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 58 // int size = 6; | 58 // int size = 6; |
| 59 // for (int i = 0; i < size; i++) { | 59 // for (int i = 0; i < size; i++) { |
| 60 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | 60 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); |
| 61 // DartEntryImpl entry = new DartEntryImpl(); | 61 // DartEntryImpl entry = new DartEntryImpl(); |
| 62 // entry.setValue(DartEntry.PARSED_UNIT, null); | 62 // entry.setValue(DartEntry.PARSED_UNIT, null); |
| 63 // cache.put(source, entry); | 63 // cache.put(source, entry); |
| 64 // cache.accessedAst(source); | 64 // cache.accessedAst(source); |
| 65 // } | 65 // } |
| 66 // _assertNonFlushedCount(size, cache); | 66 // _assertNonFlushedCount(size, cache); |
| 67 // int newSize = size - 2; | 67 // int newSize = size - 2; |
| 68 // partition.maxCacheSize = newSize; | 68 // partition.maxCacheSize = newSize; |
| 69 // _assertNonFlushedCount(newSize, cache); | 69 // _assertNonFlushedCount(newSize, cache); |
| 70 // } | 70 // } |
| 71 // void test_size() { | 71 // void test_size() { |
| 72 // CachePartition partition = new UniversalCachePartition(8, new DefaultRete
ntionPolicy()); | 72 // CachePartition partition = new UniversalCachePartition(null, 8, new Defau
ltRetentionPolicy()); |
| 73 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); | 73 // AnalysisCache cache = new AnalysisCache(<CachePartition> [partition]); |
| 74 // int size = 4; | 74 // int size = 4; |
| 75 // for (int i = 0; i < size; i++) { | 75 // for (int i = 0; i < size; i++) { |
| 76 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | 76 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); |
| 77 // cache.put(source, new DartEntryImpl()); | 77 // cache.put(source, new DartEntryImpl()); |
| 78 // cache.accessedAst(source); | 78 // cache.accessedAst(source); |
| 79 // } | 79 // } |
| 80 // JUnitTestCase.assertEquals(size, cache.size()); | 80 // JUnitTestCase.assertEquals(size, cache.size()); |
| 81 // } | 81 // } |
| 82 // void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { | 82 // void _assertNonFlushedCount(int expectedCount, AnalysisCache cache) { |
| (...skipping 5161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5244 // }); | 5244 // }); |
| 5245 // _ut.test('test_perform_valid', () { | 5245 // _ut.test('test_perform_valid', () { |
| 5246 // final __test = new ScanDartTaskTest(); | 5246 // final __test = new ScanDartTaskTest(); |
| 5247 // runJUnitTest(__test, __test.test_perform_valid); | 5247 // runJUnitTest(__test, __test.test_perform_valid); |
| 5248 // }); | 5248 // }); |
| 5249 // }); | 5249 // }); |
| 5250 // } | 5250 // } |
| 5251 // } | 5251 // } |
| 5252 // class SdkCachePartitionTest extends EngineTestCase { | 5252 // class SdkCachePartitionTest extends EngineTestCase { |
| 5253 // void test_contains_false() { | 5253 // void test_contains_false() { |
| 5254 // SdkCachePartition partition = new SdkCachePartition(8); | 5254 // SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 5255 // Source source = new TestSource(); | 5255 // Source source = new TestSource(); |
| 5256 // JUnitTestCase.assertFalse(partition.contains(source)); | 5256 // JUnitTestCase.assertFalse(partition.contains(source)); |
| 5257 // } | 5257 // } |
| 5258 // void test_contains_true() { | 5258 // void test_contains_true() { |
| 5259 // SdkCachePartition partition = new SdkCachePartition(8); | 5259 // SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 5260 // SourceFactory factory = new SourceFactory([new DartUriResolver(DirectoryB
asedDartSdk.defaultSdk)]); | 5260 // SourceFactory factory = new SourceFactory([new DartUriResolver(DirectoryB
asedDartSdk.defaultSdk)]); |
| 5261 // Source source = factory.forUri("dart:core"); | 5261 // Source source = factory.forUri("dart:core"); |
| 5262 // JUnitTestCase.assertTrue(partition.contains(source)); | 5262 // JUnitTestCase.assertTrue(partition.contains(source)); |
| 5263 // } | 5263 // } |
| 5264 // void test_creation() { | 5264 // void test_creation() { |
| 5265 // JUnitTestCase.assertNotNull(new SdkCachePartition(8)); | 5265 // JUnitTestCase.assertNotNull(new SdkCachePartition(null, 8)); |
| 5266 // } | 5266 // } |
| 5267 // static dartSuite() { | 5267 // static dartSuite() { |
| 5268 // _ut.group('SdkCachePartitionTest', () { | 5268 // _ut.group('SdkCachePartitionTest', () { |
| 5269 // _ut.test('test_contains_false', () { | 5269 // _ut.test('test_contains_false', () { |
| 5270 // final __test = new SdkCachePartitionTest(); | 5270 // final __test = new SdkCachePartitionTest(); |
| 5271 // runJUnitTest(__test, __test.test_contains_false); | 5271 // runJUnitTest(__test, __test.test_contains_false); |
| 5272 // }); | 5272 // }); |
| 5273 // _ut.test('test_contains_true', () { | 5273 // _ut.test('test_contains_true', () { |
| 5274 // final __test = new SdkCachePartitionTest(); | 5274 // final __test = new SdkCachePartitionTest(); |
| 5275 // runJUnitTest(__test, __test.test_contains_true); | 5275 // runJUnitTest(__test, __test.test_contains_true); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5390 // @override | 5390 // @override |
| 5391 // TimestampedData<String> getContents(Source source) { | 5391 // TimestampedData<String> getContents(Source source) { |
| 5392 // JUnitTestCase.fail("Unexpected invocation of getContents"); | 5392 // JUnitTestCase.fail("Unexpected invocation of getContents"); |
| 5393 // return null; | 5393 // return null; |
| 5394 // } | 5394 // } |
| 5395 // @override | 5395 // @override |
| 5396 // void getContentsToReceiver(Source source, Source_ContentReceiver receiver)
{ | 5396 // void getContentsToReceiver(Source source, Source_ContentReceiver receiver)
{ |
| 5397 // JUnitTestCase.fail("Unexpected invocation of getContentsToReceiver"); | 5397 // JUnitTestCase.fail("Unexpected invocation of getContentsToReceiver"); |
| 5398 // } | 5398 // } |
| 5399 // @override | 5399 // @override |
| 5400 // InternalAnalysisContext getContextFor(Source source) { |
| 5401 // JUnitTestCase.fail("Unexpected invocation of getContextFor"); |
| 5402 // return null; |
| 5403 // } |
| 5404 // @override |
| 5400 // DeclaredVariables get declaredVariables { | 5405 // DeclaredVariables get declaredVariables { |
| 5401 // JUnitTestCase.fail("Unexpected invocation of getDeclaredVariables"); | 5406 // JUnitTestCase.fail("Unexpected invocation of getDeclaredVariables"); |
| 5402 // return null; | 5407 // return null; |
| 5403 // } | 5408 // } |
| 5404 // @override | 5409 // @override |
| 5405 // Element getElement(ElementLocation location) { | 5410 // Element getElement(ElementLocation location) { |
| 5406 // JUnitTestCase.fail("Unexpected invocation of getElement"); | 5411 // JUnitTestCase.fail("Unexpected invocation of getElement"); |
| 5407 // return null; | 5412 // return null; |
| 5408 // } | 5413 // } |
| 5409 // @override | 5414 // @override |
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6534 // JUnitTestCase.assertNotNull(task.tokenStream); | 6539 // JUnitTestCase.assertNotNull(task.tokenStream); |
| 6535 // EngineTestCase.assertLength(0, task.errors); | 6540 // EngineTestCase.assertLength(0, task.errors); |
| 6536 // JUnitTestCase.assertNotNull(task.lineInfo); | 6541 // JUnitTestCase.assertNotNull(task.lineInfo); |
| 6537 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); | 6542 // JUnitTestCase.assertEquals(context.getModificationStamp(source), task.mod
ificationTime); |
| 6538 // JUnitTestCase.assertSame(source, task.source); | 6543 // JUnitTestCase.assertSame(source, task.source); |
| 6539 // return true; | 6544 // return true; |
| 6540 // } | 6545 // } |
| 6541 // } | 6546 // } |
| 6542 // class UniversalCachePartitionTest extends EngineTestCase { | 6547 // class UniversalCachePartitionTest extends EngineTestCase { |
| 6543 // void test_contains() { | 6548 // void test_contains() { |
| 6544 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6549 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6545 // TestSource source = new TestSource(); | 6550 // TestSource source = new TestSource(); |
| 6546 // JUnitTestCase.assertTrue(partition.contains(source)); | 6551 // JUnitTestCase.assertTrue(partition.contains(source)); |
| 6547 // } | 6552 // } |
| 6548 // void test_creation() { | 6553 // void test_creation() { |
| 6549 // JUnitTestCase.assertNotNull(new UniversalCachePartition(8, null)); | 6554 // JUnitTestCase.assertNotNull(new UniversalCachePartition(null, 8, null)); |
| 6550 // } | 6555 // } |
| 6551 // void test_entrySet() { | 6556 // void test_entrySet() { |
| 6552 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6557 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6553 // TestSource source = new TestSource(); | 6558 // TestSource source = new TestSource(); |
| 6554 // DartEntryImpl entry = new DartEntryImpl(); | 6559 // DartEntryImpl entry = new DartEntryImpl(); |
| 6555 // partition.put(source, entry); | 6560 // partition.put(source, entry); |
| 6556 // JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(ge
tMapEntrySet(partition.map)); | 6561 // JavaIterator<MapEntry<Source, SourceEntry>> entries = new JavaIterator(ge
tMapEntrySet(partition.map)); |
| 6557 // JUnitTestCase.assertTrue(entries.hasNext); | 6562 // JUnitTestCase.assertTrue(entries.hasNext); |
| 6558 // MapEntry<Source, SourceEntry> mapEntry = entries.next(); | 6563 // MapEntry<Source, SourceEntry> mapEntry = entries.next(); |
| 6559 // JUnitTestCase.assertSame(source, mapEntry.getKey()); | 6564 // JUnitTestCase.assertSame(source, mapEntry.getKey()); |
| 6560 // JUnitTestCase.assertSame(entry, mapEntry.getValue()); | 6565 // JUnitTestCase.assertSame(entry, mapEntry.getValue()); |
| 6561 // JUnitTestCase.assertFalse(entries.hasNext); | 6566 // JUnitTestCase.assertFalse(entries.hasNext); |
| 6562 // } | 6567 // } |
| 6563 // void test_get() { | 6568 // void test_get() { |
| 6564 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6569 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6565 // TestSource source = new TestSource(); | 6570 // TestSource source = new TestSource(); |
| 6566 // JUnitTestCase.assertNull(partition.get(source)); | 6571 // JUnitTestCase.assertNull(partition.get(source)); |
| 6567 // } | 6572 // } |
| 6568 // void test_put_noFlush() { | 6573 // void test_put_noFlush() { |
| 6569 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6574 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6570 // TestSource source = new TestSource(); | 6575 // TestSource source = new TestSource(); |
| 6571 // DartEntryImpl entry = new DartEntryImpl(); | 6576 // DartEntryImpl entry = new DartEntryImpl(); |
| 6572 // partition.put(source, entry); | 6577 // partition.put(source, entry); |
| 6573 // JUnitTestCase.assertSame(entry, partition.get(source)); | 6578 // JUnitTestCase.assertSame(entry, partition.get(source)); |
| 6574 // } | 6579 // } |
| 6575 // void test_remove() { | 6580 // void test_remove() { |
| 6576 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6581 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6577 // TestSource source = new TestSource(); | 6582 // TestSource source = new TestSource(); |
| 6578 // DartEntryImpl entry = new DartEntryImpl(); | 6583 // DartEntryImpl entry = new DartEntryImpl(); |
| 6579 // partition.put(source, entry); | 6584 // partition.put(source, entry); |
| 6580 // JUnitTestCase.assertSame(entry, partition.get(source)); | 6585 // JUnitTestCase.assertSame(entry, partition.get(source)); |
| 6581 // partition.remove(source); | 6586 // partition.remove(source); |
| 6582 // JUnitTestCase.assertNull(partition.get(source)); | 6587 // JUnitTestCase.assertNull(partition.get(source)); |
| 6583 // } | 6588 // } |
| 6584 // void test_setMaxCacheSize() { | 6589 // void test_setMaxCacheSize() { |
| 6585 // UniversalCachePartition partition = new UniversalCachePartition(8, new Ca
cheRetentionPolicy_UniversalCachePartitionTest_test_setMaxCacheSize()); | 6590 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
new CacheRetentionPolicy_UniversalCachePartitionTest_test_setMaxCacheSize()); |
| 6586 // int size = 6; | 6591 // int size = 6; |
| 6587 // for (int i = 0; i < size; i++) { | 6592 // for (int i = 0; i < size; i++) { |
| 6588 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | 6593 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); |
| 6589 // DartEntryImpl entry = new DartEntryImpl(); | 6594 // DartEntryImpl entry = new DartEntryImpl(); |
| 6590 // entry.setValue(DartEntry.PARSED_UNIT, null); | 6595 // entry.setValue(DartEntry.PARSED_UNIT, null); |
| 6591 // partition.put(source, entry); | 6596 // partition.put(source, entry); |
| 6592 // partition.accessedAst(source); | 6597 // partition.accessedAst(source); |
| 6593 // } | 6598 // } |
| 6594 // _assertNonFlushedCount(size, partition); | 6599 // _assertNonFlushedCount(size, partition); |
| 6595 // int newSize = size - 2; | 6600 // int newSize = size - 2; |
| 6596 // partition.maxCacheSize = newSize; | 6601 // partition.maxCacheSize = newSize; |
| 6597 // _assertNonFlushedCount(newSize, partition); | 6602 // _assertNonFlushedCount(newSize, partition); |
| 6598 // } | 6603 // } |
| 6599 // void test_size() { | 6604 // void test_size() { |
| 6600 // UniversalCachePartition partition = new UniversalCachePartition(8, null); | 6605 // UniversalCachePartition partition = new UniversalCachePartition(null, 8,
null); |
| 6601 // int size = 4; | 6606 // int size = 4; |
| 6602 // for (int i = 0; i < size; i++) { | 6607 // for (int i = 0; i < size; i++) { |
| 6603 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); | 6608 // Source source = new TestSource.con1(FileUtilities2.createFile("/test${i
}.dart"), ""); |
| 6604 // partition.put(source, new DartEntryImpl()); | 6609 // partition.put(source, new DartEntryImpl()); |
| 6605 // partition.accessedAst(source); | 6610 // partition.accessedAst(source); |
| 6606 // } | 6611 // } |
| 6607 // JUnitTestCase.assertEquals(size, partition.size()); | 6612 // JUnitTestCase.assertEquals(size, partition.size()); |
| 6608 // } | 6613 // } |
| 6609 // void _assertNonFlushedCount(int expectedCount, UniversalCachePartition part
ition) { | 6614 // void _assertNonFlushedCount(int expectedCount, UniversalCachePartition part
ition) { |
| 6610 // int nonFlushedCount = 0; | 6615 // int nonFlushedCount = 0; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6765 // AnalysisCacheTest.dartSuite(); | 6770 // AnalysisCacheTest.dartSuite(); |
| 6766 // DartEntryImplTest.dartSuite(); | 6771 // DartEntryImplTest.dartSuite(); |
| 6767 // HtmlEntryImplTest.dartSuite(); | 6772 // HtmlEntryImplTest.dartSuite(); |
| 6768 // PartitionManagerTest.dartSuite(); | 6773 // PartitionManagerTest.dartSuite(); |
| 6769 // SdkCachePartitionTest.dartSuite(); | 6774 // SdkCachePartitionTest.dartSuite(); |
| 6770 // UniversalCachePartitionTest.dartSuite(); | 6775 // UniversalCachePartitionTest.dartSuite(); |
| 6771 // } | 6776 // } |
| 6772 | 6777 |
| 6773 main() { | 6778 main() { |
| 6774 } | 6779 } |
| OLD | NEW |