/** Test for {@link DartFunction#isGlobal()} and {@link DartFunction#isLocal()}. */ public void test_isGlobal_isLocal() throws Exception { TestProject testProject = new TestProject("Test"); try { CompilationUnit unit = testProject.setUnitContent( "Test.dart", Joiner.on("\n") .join( "// filler filler filler filler filler filler filler filler filler filler", "f() {", " v() {};", "}", "")); // global function DartFunction globalFunction = (DartFunction) unit.getChildren()[0]; assertTrue(globalFunction.isGlobal()); assertFalse(globalFunction.isLocal()); // local functions DartElement[] functions = globalFunction.getChildren(); assertThat(functions).hasSize(1); // v { DartFunction f = (DartFunction) functions[0]; assertFalse(f.isGlobal()); assertTrue(f.isLocal()); } } finally { testProject.dispose(); } }