protected void assertScope(String scope, int offset) throws BadLocationException { assertEquals( "Scope doesn't match", scope, getDocumentScopeManager() .getScopeAtOffset(TextEditorUtils.getSourceViewer(editor), offset)); }
/** * This level gives back only partition level scopes. * * @throws Exception */ public void testGetScopeAtOffsetDoc() throws Exception { setUpStandardScopes(); createAndOpenFile( "testing", ".js", "if(Object.isUndefined(Effect))\nthrow(\"dragdrop.js requires including script.aculo.us' effects.js library\");"); ISourceViewer viewer = TextEditorUtils.getSourceViewer(editor); assertScope("source.js", 1, viewer.getDocument()); assertScope("source.js", 7, viewer.getDocument()); assertScope("source.js string.quoted.double.js", 50, viewer.getDocument()); }