eclipse / Xpect

This repository has been rewritten to move to the Eclipse Foundation. Find the old history here: https://github.com/TypeFox/Xpect
http://www.xpect-tests.org/
Eclipse Public License 2.0
30 stars 28 forks source link

[scoping] support to test empty scope #161

Open meysholdt opened 9 years ago

meysholdt commented 9 years ago

e.g.

@Inject
private IScopeProvider scopeProvider;

@Xpect
@ParameterParser(syntax = "('at' arg0=OFFSET)? 'name' arg1=STRING")
public void scopeIsEmpty(@ThisOffset EObject arg0, String arg1) {
    EReference reference = (EReference) arg0.eClass().getEStructuralFeature(arg1);
    IScope scope = scopeProvider.getScope(arg0, reference);
    Assert.assertTrue(scope.getAllElements().iterator().hasNext());
}