| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.element_test; | 4 library engine.element_test; |
| 5 | 5 |
| 6 import 'package:analyzer/src/generated/java_core.dart'; | 6 import 'package:analyzer/src/generated/java_core.dart'; |
| 7 import 'package:analyzer/src/generated/java_engine_io.dart'; | 7 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 8 import 'package:analyzer/src/generated/java_junit.dart'; | 8 import 'package:analyzer/src/generated/java_junit.dart'; |
| 9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 10 import 'package:analyzer/src/generated/utilities_dart.dart'; | 10 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 11 import 'package:analyzer/src/generated/ast.dart'; | 11 import 'package:analyzer/src/generated/ast.dart'; |
| 12 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; | 13 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, Analys
isContextImpl; |
| 14 import 'package:unittest/unittest.dart' as _ut; | 14 import 'package:unittest/unittest.dart' as _ut; |
| 15 import 'test_support.dart'; | 15 import 'test_support.dart'; |
| 16 import 'ast_test.dart' show ASTFactory; | 16 import 'ast_test.dart' show ASTFactory; |
| 17 import 'resolver_test.dart' show TestTypeProvider; | 17 import 'resolver_test.dart' show TestTypeProvider, AnalysisContextHelper; |
| 18 | 18 |
| 19 class ElementLocationImplTest extends EngineTestCase { | 19 class ElementLocationImplTest extends EngineTestCase { |
| 20 void test_create_encoding() { | 20 void test_create_encoding() { |
| 21 String encoding = "a;b;c"; | 21 String encoding = "a;b;c"; |
| 22 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 22 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 23 JUnitTestCase.assertEquals(encoding, location.encoding); | 23 JUnitTestCase.assertEquals(encoding, location.encoding); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void test_equals_equal() { | 26 void test_equals_equal() { |
| 27 String encoding = "a;b;c"; | 27 String encoding = "a;b;c"; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 List<PrefixElement> prefixes = library.prefixes; | 217 List<PrefixElement> prefixes = library.prefixes; |
| 218 EngineTestCase.assertLength(2, prefixes); | 218 EngineTestCase.assertLength(2, prefixes); |
| 219 if (identical(prefixA, prefixes[0])) { | 219 if (identical(prefixA, prefixes[0])) { |
| 220 JUnitTestCase.assertSame(prefixB, prefixes[1]); | 220 JUnitTestCase.assertSame(prefixB, prefixes[1]); |
| 221 } else { | 221 } else { |
| 222 JUnitTestCase.assertSame(prefixB, prefixes[0]); | 222 JUnitTestCase.assertSame(prefixB, prefixes[0]); |
| 223 JUnitTestCase.assertSame(prefixA, prefixes[1]); | 223 JUnitTestCase.assertSame(prefixA, prefixes[1]); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 void test_getVisibleLibraries_cycle() { |
| 228 AnalysisContext context = createAnalysisContext(); |
| 229 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 230 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 231 libraryA.imports = <ImportElementImpl> [ElementFactory.importFor(library, nu
ll, [])]; |
| 232 library.imports = <ImportElementImpl> [ElementFactory.importFor(libraryA, nu
ll, [])]; |
| 233 List<LibraryElement> libraries = library.visibleLibraries; |
| 234 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library, libraryA],
libraries); |
| 235 } |
| 236 |
| 237 void test_getVisibleLibraries_directExports() { |
| 238 AnalysisContext context = createAnalysisContext(); |
| 239 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 240 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 241 library.exports = <ExportElementImpl> [ElementFactory.exportFor(libraryA, []
)]; |
| 242 List<LibraryElement> libraries = library.visibleLibraries; |
| 243 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], libraries
); |
| 244 } |
| 245 |
| 246 void test_getVisibleLibraries_directImports() { |
| 247 AnalysisContext context = createAnalysisContext(); |
| 248 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 249 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 250 library.imports = <ImportElementImpl> [ElementFactory.importFor(libraryA, nu
ll, [])]; |
| 251 List<LibraryElement> libraries = library.visibleLibraries; |
| 252 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library, libraryA],
libraries); |
| 253 } |
| 254 |
| 255 void test_getVisibleLibraries_indirectExports() { |
| 256 AnalysisContext context = createAnalysisContext(); |
| 257 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 258 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 259 LibraryElementImpl libraryAA = ElementFactory.library(context, "AA"); |
| 260 libraryA.exports = <ExportElementImpl> [ElementFactory.exportFor(libraryAA,
[])]; |
| 261 library.imports = <ImportElementImpl> [ElementFactory.importFor(libraryA, nu
ll, [])]; |
| 262 List<LibraryElement> libraries = library.visibleLibraries; |
| 263 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library, libraryA,
libraryAA], libraries); |
| 264 } |
| 265 |
| 266 void test_getVisibleLibraries_indirectImports() { |
| 267 AnalysisContext context = createAnalysisContext(); |
| 268 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 269 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 270 LibraryElementImpl libraryAA = ElementFactory.library(context, "AA"); |
| 271 LibraryElementImpl libraryB = ElementFactory.library(context, "B"); |
| 272 libraryA.imports = <ImportElementImpl> [ElementFactory.importFor(libraryAA,
null, [])]; |
| 273 library.imports = <ImportElementImpl> [ |
| 274 ElementFactory.importFor(libraryA, null, []), |
| 275 ElementFactory.importFor(libraryB, null, [])]; |
| 276 List<LibraryElement> libraries = library.visibleLibraries; |
| 277 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library, libraryA,
libraryAA, libraryB], libraries); |
| 278 } |
| 279 |
| 280 void test_getVisibleLibraries_noImports() { |
| 281 AnalysisContext context = createAnalysisContext(); |
| 282 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 283 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); |
| 284 } |
| 285 |
| 227 void test_isUpToDate() { | 286 void test_isUpToDate() { |
| 228 AnalysisContext context = createAnalysisContext(); | 287 AnalysisContext context = createAnalysisContext(); |
| 229 context.sourceFactory = new SourceFactory.con2([]); | 288 context.sourceFactory = new SourceFactory.con2([]); |
| 230 LibraryElement library = ElementFactory.library(context, "foo"); | 289 LibraryElement library = ElementFactory.library(context, "foo"); |
| 231 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); | 290 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); |
| 232 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 291 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 233 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 292 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 234 } | 293 } |
| 235 | 294 |
| 236 void test_setImports() { | 295 void test_setImports() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 254 runJUnitTest(__test, __test.test_creation); | 313 runJUnitTest(__test, __test.test_creation); |
| 255 }); | 314 }); |
| 256 _ut.test('test_getImportedLibraries', () { | 315 _ut.test('test_getImportedLibraries', () { |
| 257 final __test = new LibraryElementImplTest(); | 316 final __test = new LibraryElementImplTest(); |
| 258 runJUnitTest(__test, __test.test_getImportedLibraries); | 317 runJUnitTest(__test, __test.test_getImportedLibraries); |
| 259 }); | 318 }); |
| 260 _ut.test('test_getPrefixes', () { | 319 _ut.test('test_getPrefixes', () { |
| 261 final __test = new LibraryElementImplTest(); | 320 final __test = new LibraryElementImplTest(); |
| 262 runJUnitTest(__test, __test.test_getPrefixes); | 321 runJUnitTest(__test, __test.test_getPrefixes); |
| 263 }); | 322 }); |
| 323 _ut.test('test_getVisibleLibraries_cycle', () { |
| 324 final __test = new LibraryElementImplTest(); |
| 325 runJUnitTest(__test, __test.test_getVisibleLibraries_cycle); |
| 326 }); |
| 327 _ut.test('test_getVisibleLibraries_directExports', () { |
| 328 final __test = new LibraryElementImplTest(); |
| 329 runJUnitTest(__test, __test.test_getVisibleLibraries_directExports); |
| 330 }); |
| 331 _ut.test('test_getVisibleLibraries_directImports', () { |
| 332 final __test = new LibraryElementImplTest(); |
| 333 runJUnitTest(__test, __test.test_getVisibleLibraries_directImports); |
| 334 }); |
| 335 _ut.test('test_getVisibleLibraries_indirectExports', () { |
| 336 final __test = new LibraryElementImplTest(); |
| 337 runJUnitTest(__test, __test.test_getVisibleLibraries_indirectExports); |
| 338 }); |
| 339 _ut.test('test_getVisibleLibraries_indirectImports', () { |
| 340 final __test = new LibraryElementImplTest(); |
| 341 runJUnitTest(__test, __test.test_getVisibleLibraries_indirectImports); |
| 342 }); |
| 343 _ut.test('test_getVisibleLibraries_noImports', () { |
| 344 final __test = new LibraryElementImplTest(); |
| 345 runJUnitTest(__test, __test.test_getVisibleLibraries_noImports); |
| 346 }); |
| 264 _ut.test('test_isUpToDate', () { | 347 _ut.test('test_isUpToDate', () { |
| 265 final __test = new LibraryElementImplTest(); | 348 final __test = new LibraryElementImplTest(); |
| 266 runJUnitTest(__test, __test.test_isUpToDate); | 349 runJUnitTest(__test, __test.test_isUpToDate); |
| 267 }); | 350 }); |
| 268 _ut.test('test_setImports', () { | 351 _ut.test('test_setImports', () { |
| 269 final __test = new LibraryElementImplTest(); | 352 final __test = new LibraryElementImplTest(); |
| 270 runJUnitTest(__test, __test.test_setImports); | 353 runJUnitTest(__test, __test.test_setImports); |
| 271 }); | 354 }); |
| 272 }); | 355 }); |
| 273 } | 356 } |
| (...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 getter.static = isStatic; | 2286 getter.static = isStatic; |
| 2204 getter.variable = field; | 2287 getter.variable = field; |
| 2205 getter.returnType = type; | 2288 getter.returnType = type; |
| 2206 field.getter = getter; | 2289 field.getter = getter; |
| 2207 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2290 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 2208 getter.type = getterType; | 2291 getter.type = getterType; |
| 2209 return getter; | 2292 return getter; |
| 2210 } | 2293 } |
| 2211 | 2294 |
| 2212 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { | 2295 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { |
| 2213 ImportElementImpl spec = new ImportElementImpl(); | 2296 ImportElementImpl spec = new ImportElementImpl(0); |
| 2214 spec.importedLibrary = importedLibrary; | 2297 spec.importedLibrary = importedLibrary; |
| 2215 spec.prefix = prefix; | 2298 spec.prefix = prefix; |
| 2216 spec.combinators = combinators; | 2299 spec.combinators = combinators; |
| 2217 return spec; | 2300 return spec; |
| 2218 } | 2301 } |
| 2219 | 2302 |
| 2220 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ | 2303 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ |
| 2221 String fileName = "/${libraryName}.dart"; | 2304 String fileName = "/${libraryName}.dart"; |
| 2222 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); | 2305 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); |
| 2223 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); | 2306 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 } | 2507 } |
| 2425 | 2508 |
| 2426 void test_getMethod_undeclared() { | 2509 void test_getMethod_undeclared() { |
| 2427 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2510 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2428 String methodName = "m"; | 2511 String methodName = "m"; |
| 2429 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2512 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2430 classA.methods = <MethodElement> [method]; | 2513 classA.methods = <MethodElement> [method]; |
| 2431 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); | 2514 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); |
| 2432 } | 2515 } |
| 2433 | 2516 |
| 2517 void test_getNode() { |
| 2518 AnalysisContextHelper contextHelper = new AnalysisContextHelper(); |
| 2519 AnalysisContext context = contextHelper.context; |
| 2520 Source source = contextHelper.addSource("/test.dart", EngineTestCase.createS
ource(["class A {}", "class B {}"])); |
| 2521 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 2522 CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; |
| 2523 { |
| 2524 ClassElement elementA = unitElement.getType("A"); |
| 2525 ClassDeclaration nodeA = elementA.node; |
| 2526 JUnitTestCase.assertNotNull(nodeA); |
| 2527 JUnitTestCase.assertEquals("A", nodeA.name.name); |
| 2528 JUnitTestCase.assertSame(elementA, nodeA.element); |
| 2529 } |
| 2530 { |
| 2531 ClassElement elementB = unitElement.getType("B"); |
| 2532 ClassDeclaration nodeB = elementB.node; |
| 2533 JUnitTestCase.assertNotNull(nodeB); |
| 2534 JUnitTestCase.assertEquals("B", nodeB.name.name); |
| 2535 JUnitTestCase.assertSame(elementB, nodeB.element); |
| 2536 } |
| 2537 } |
| 2538 |
| 2434 void test_hasNonFinalField_false_const() { | 2539 void test_hasNonFinalField_false_const() { |
| 2435 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2540 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2436 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; | 2541 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; |
| 2437 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2542 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 2438 } | 2543 } |
| 2439 | 2544 |
| 2440 void test_hasNonFinalField_false_final() { | 2545 void test_hasNonFinalField_false_final() { |
| 2441 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2546 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2442 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; | 2547 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; |
| 2443 JUnitTestCase.assertFalse(classA.hasNonFinalField()); | 2548 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 runJUnitTest(__test, __test.test_getAllSupertypes_recursive); | 2694 runJUnitTest(__test, __test.test_getAllSupertypes_recursive); |
| 2590 }); | 2695 }); |
| 2591 _ut.test('test_getMethod_declared', () { | 2696 _ut.test('test_getMethod_declared', () { |
| 2592 final __test = new ClassElementImplTest(); | 2697 final __test = new ClassElementImplTest(); |
| 2593 runJUnitTest(__test, __test.test_getMethod_declared); | 2698 runJUnitTest(__test, __test.test_getMethod_declared); |
| 2594 }); | 2699 }); |
| 2595 _ut.test('test_getMethod_undeclared', () { | 2700 _ut.test('test_getMethod_undeclared', () { |
| 2596 final __test = new ClassElementImplTest(); | 2701 final __test = new ClassElementImplTest(); |
| 2597 runJUnitTest(__test, __test.test_getMethod_undeclared); | 2702 runJUnitTest(__test, __test.test_getMethod_undeclared); |
| 2598 }); | 2703 }); |
| 2704 _ut.test('test_getNode', () { |
| 2705 final __test = new ClassElementImplTest(); |
| 2706 runJUnitTest(__test, __test.test_getNode); |
| 2707 }); |
| 2599 _ut.test('test_hasNonFinalField_false_const', () { | 2708 _ut.test('test_hasNonFinalField_false_const', () { |
| 2600 final __test = new ClassElementImplTest(); | 2709 final __test = new ClassElementImplTest(); |
| 2601 runJUnitTest(__test, __test.test_hasNonFinalField_false_const); | 2710 runJUnitTest(__test, __test.test_hasNonFinalField_false_const); |
| 2602 }); | 2711 }); |
| 2603 _ut.test('test_hasNonFinalField_false_final', () { | 2712 _ut.test('test_hasNonFinalField_false_final', () { |
| 2604 final __test = new ClassElementImplTest(); | 2713 final __test = new ClassElementImplTest(); |
| 2605 runJUnitTest(__test, __test.test_hasNonFinalField_false_final); | 2714 runJUnitTest(__test, __test.test_hasNonFinalField_false_final); |
| 2606 }); | 2715 }); |
| 2607 _ut.test('test_hasNonFinalField_false_recursive', () { | 2716 _ut.test('test_hasNonFinalField_false_recursive', () { |
| 2608 final __test = new ClassElementImplTest(); | 2717 final __test = new ClassElementImplTest(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); | 2815 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library2)); |
| 2707 } | 2816 } |
| 2708 | 2817 |
| 2709 void test_isAccessibleIn_public_sameLibrary() { | 2818 void test_isAccessibleIn_public_sameLibrary() { |
| 2710 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 2819 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2711 ClassElement classElement = ElementFactory.classElement2("C", []); | 2820 ClassElement classElement = ElementFactory.classElement2("C", []); |
| 2712 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; | 2821 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; |
| 2713 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); | 2822 JUnitTestCase.assertTrue(classElement.isAccessibleIn(library)); |
| 2714 } | 2823 } |
| 2715 | 2824 |
| 2825 void test_isPrivate_false() { |
| 2826 Element element = ElementFactory.classElement2("C", []); |
| 2827 JUnitTestCase.assertFalse(element.isPrivate); |
| 2828 } |
| 2829 |
| 2830 void test_isPrivate_null() { |
| 2831 Element element = ElementFactory.classElement2(null, []); |
| 2832 JUnitTestCase.assertTrue(element.isPrivate); |
| 2833 } |
| 2834 |
| 2835 void test_isPrivate_true() { |
| 2836 Element element = ElementFactory.classElement2("_C", []); |
| 2837 JUnitTestCase.assertTrue(element.isPrivate); |
| 2838 } |
| 2839 |
| 2840 void test_isPublic_false() { |
| 2841 Element element = ElementFactory.classElement2("_C", []); |
| 2842 JUnitTestCase.assertFalse(element.isPublic); |
| 2843 } |
| 2844 |
| 2845 void test_isPublic_null() { |
| 2846 Element element = ElementFactory.classElement2(null, []); |
| 2847 JUnitTestCase.assertFalse(element.isPublic); |
| 2848 } |
| 2849 |
| 2850 void test_isPublic_true() { |
| 2851 Element element = ElementFactory.classElement2("C", []); |
| 2852 JUnitTestCase.assertTrue(element.isPublic); |
| 2853 } |
| 2854 |
| 2716 void test_SORT_BY_OFFSET() { | 2855 void test_SORT_BY_OFFSET() { |
| 2717 ClassElementImpl classElementA = ElementFactory.classElement2("A", []); | 2856 ClassElementImpl classElementA = ElementFactory.classElement2("A", []); |
| 2718 classElementA.nameOffset = 1; | 2857 classElementA.nameOffset = 1; |
| 2719 ClassElementImpl classElementB = ElementFactory.classElement2("B", []); | 2858 ClassElementImpl classElementB = ElementFactory.classElement2("B", []); |
| 2720 classElementB.nameOffset = 2; | 2859 classElementB.nameOffset = 2; |
| 2721 JUnitTestCase.assertEquals(0, Element.SORT_BY_OFFSET(classElementA, classEle
mentA)); | 2860 JUnitTestCase.assertEquals(0, Element.SORT_BY_OFFSET(classElementA, classEle
mentA)); |
| 2722 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementA, classElementB
) < 0); | 2861 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementA, classElementB
) < 0); |
| 2723 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementB, classElementA
) > 0); | 2862 JUnitTestCase.assertTrue(Element.SORT_BY_OFFSET(classElementB, classElementA
) > 0); |
| 2724 } | 2863 } |
| 2725 | 2864 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2742 runJUnitTest(__test, __test.test_isAccessibleIn_private_sameLibrary); | 2881 runJUnitTest(__test, __test.test_isAccessibleIn_private_sameLibrary); |
| 2743 }); | 2882 }); |
| 2744 _ut.test('test_isAccessibleIn_public_differentLibrary', () { | 2883 _ut.test('test_isAccessibleIn_public_differentLibrary', () { |
| 2745 final __test = new ElementImplTest(); | 2884 final __test = new ElementImplTest(); |
| 2746 runJUnitTest(__test, __test.test_isAccessibleIn_public_differentLibrary)
; | 2885 runJUnitTest(__test, __test.test_isAccessibleIn_public_differentLibrary)
; |
| 2747 }); | 2886 }); |
| 2748 _ut.test('test_isAccessibleIn_public_sameLibrary', () { | 2887 _ut.test('test_isAccessibleIn_public_sameLibrary', () { |
| 2749 final __test = new ElementImplTest(); | 2888 final __test = new ElementImplTest(); |
| 2750 runJUnitTest(__test, __test.test_isAccessibleIn_public_sameLibrary); | 2889 runJUnitTest(__test, __test.test_isAccessibleIn_public_sameLibrary); |
| 2751 }); | 2890 }); |
| 2891 _ut.test('test_isPrivate_false', () { |
| 2892 final __test = new ElementImplTest(); |
| 2893 runJUnitTest(__test, __test.test_isPrivate_false); |
| 2894 }); |
| 2895 _ut.test('test_isPrivate_null', () { |
| 2896 final __test = new ElementImplTest(); |
| 2897 runJUnitTest(__test, __test.test_isPrivate_null); |
| 2898 }); |
| 2899 _ut.test('test_isPrivate_true', () { |
| 2900 final __test = new ElementImplTest(); |
| 2901 runJUnitTest(__test, __test.test_isPrivate_true); |
| 2902 }); |
| 2903 _ut.test('test_isPublic_false', () { |
| 2904 final __test = new ElementImplTest(); |
| 2905 runJUnitTest(__test, __test.test_isPublic_false); |
| 2906 }); |
| 2907 _ut.test('test_isPublic_null', () { |
| 2908 final __test = new ElementImplTest(); |
| 2909 runJUnitTest(__test, __test.test_isPublic_null); |
| 2910 }); |
| 2911 _ut.test('test_isPublic_true', () { |
| 2912 final __test = new ElementImplTest(); |
| 2913 runJUnitTest(__test, __test.test_isPublic_true); |
| 2914 }); |
| 2752 }); | 2915 }); |
| 2753 } | 2916 } |
| 2754 } | 2917 } |
| 2755 | 2918 |
| 2756 class FunctionTypeImplTest extends EngineTestCase { | 2919 class FunctionTypeImplTest extends EngineTestCase { |
| 2757 void test_creation() { | 2920 void test_creation() { |
| 2758 JUnitTestCase.assertNotNull(new FunctionTypeImpl.con1(new FunctionElementImp
l.con1(ASTFactory.identifier3("f")))); | 2921 JUnitTestCase.assertNotNull(new FunctionTypeImpl.con1(new FunctionElementImp
l.con1(ASTFactory.identifier3("f")))); |
| 2759 } | 2922 } |
| 2760 | 2923 |
| 2761 void test_getElement() { | 2924 void test_getElement() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2969 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2807 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 2970 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 2808 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2971 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2809 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 2972 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 2810 JUnitTestCase.assertTrue(t.isAssignableTo(s)); | 2973 JUnitTestCase.assertTrue(t.isAssignableTo(s)); |
| 2811 JUnitTestCase.assertFalse(s.isAssignableTo(t)); | 2974 JUnitTestCase.assertFalse(s.isAssignableTo(t)); |
| 2812 } | 2975 } |
| 2813 | 2976 |
| 2814 void test_isSubtypeOf_baseCase_classFunction() { | 2977 void test_isSubtypeOf_baseCase_classFunction() { |
| 2815 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); | 2978 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); |
| 2816 InterfaceTypeImpl functionType = new InterfaceTypeImpl_26(functionElement); | 2979 InterfaceTypeImpl functionType = new InterfaceTypeImpl_27(functionElement); |
| 2817 FunctionType f = ElementFactory.functionElement("f").type; | 2980 FunctionType f = ElementFactory.functionElement("f").type; |
| 2818 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); | 2981 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); |
| 2819 } | 2982 } |
| 2820 | 2983 |
| 2821 void test_isSubtypeOf_baseCase_notFunctionType() { | 2984 void test_isSubtypeOf_baseCase_notFunctionType() { |
| 2822 FunctionType f = ElementFactory.functionElement("f").type; | 2985 FunctionType f = ElementFactory.functionElement("f").type; |
| 2823 InterfaceType t = ElementFactory.classElement2("C", []).type; | 2986 InterfaceType t = ElementFactory.classElement2("C", []).type; |
| 2824 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); | 2987 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); |
| 2825 } | 2988 } |
| 2826 | 2989 |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3305 runJUnitTest(__test, __test.test_substitute2_equal); | 3468 runJUnitTest(__test, __test.test_substitute2_equal); |
| 3306 }); | 3469 }); |
| 3307 _ut.test('test_substitute2_notEqual', () { | 3470 _ut.test('test_substitute2_notEqual', () { |
| 3308 final __test = new FunctionTypeImplTest(); | 3471 final __test = new FunctionTypeImplTest(); |
| 3309 runJUnitTest(__test, __test.test_substitute2_notEqual); | 3472 runJUnitTest(__test, __test.test_substitute2_notEqual); |
| 3310 }); | 3473 }); |
| 3311 }); | 3474 }); |
| 3312 } | 3475 } |
| 3313 } | 3476 } |
| 3314 | 3477 |
| 3315 class InterfaceTypeImpl_26 extends InterfaceTypeImpl { | 3478 class InterfaceTypeImpl_27 extends InterfaceTypeImpl { |
| 3316 InterfaceTypeImpl_26(ClassElement arg0) : super.con1(arg0); | 3479 InterfaceTypeImpl_27(ClassElement arg0) : super.con1(arg0); |
| 3317 | 3480 |
| 3318 bool get isDartCoreFunction => true; | 3481 bool get isDartCoreFunction => true; |
| 3319 } | 3482 } |
| 3320 | 3483 |
| 3321 main() { | 3484 main() { |
| 3322 ElementKindTest.dartSuite(); | 3485 ElementKindTest.dartSuite(); |
| 3323 FunctionTypeImplTest.dartSuite(); | 3486 FunctionTypeImplTest.dartSuite(); |
| 3324 InterfaceTypeImplTest.dartSuite(); | 3487 InterfaceTypeImplTest.dartSuite(); |
| 3325 TypeParameterTypeImplTest.dartSuite(); | 3488 TypeParameterTypeImplTest.dartSuite(); |
| 3326 VoidTypeImplTest.dartSuite(); | 3489 VoidTypeImplTest.dartSuite(); |
| 3327 ClassElementImplTest.dartSuite(); | 3490 ClassElementImplTest.dartSuite(); |
| 3328 ElementLocationImplTest.dartSuite(); | 3491 ElementLocationImplTest.dartSuite(); |
| 3329 ElementImplTest.dartSuite(); | 3492 ElementImplTest.dartSuite(); |
| 3330 LibraryElementImplTest.dartSuite(); | 3493 LibraryElementImplTest.dartSuite(); |
| 3331 MultiplyDefinedElementImplTest.dartSuite(); | 3494 MultiplyDefinedElementImplTest.dartSuite(); |
| 3332 } | 3495 } |
| OLD | NEW |