private void int_testMissingIncludeAdded(String testname, File tmpdir) throws RuntimeException { BundleUtils utils = new BundleUtils(SVCoreTestsPlugin.getDefault().getBundle()); LogHandle log = LogFactory.getLogHandle(testname); IProject project = TestUtils.createProject("project"); addProject(project); utils.copyBundleDirToWS("/data/basic_lib_missing_inc/", project); SVDBIndexRegistry rgy = fIndexRgy; ISVDBIndex index = rgy.findCreateIndex( new NullProgressMonitor(), "GENERIC", "${workspace_loc}/project/basic_lib_missing_inc/basic_lib_pkg.sv", SVDBLibPathIndexFactory.TYPE, null); index.execIndexChangePlan(new NullProgressMonitor(), new SVDBIndexChangePlanRebuild(index)); IndexTestUtils.assertFileHasElements(fLog, index, "class1"); IndexTestUtils.assertDoesNotContain(index, "class1_2"); ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(out); ps.println("\n\n"); ps.println("class class1_2;\n"); ps.println("\n\n"); ps.println("endclass\n\n"); ps.flush(); // Now, write back the file TestUtils.copy(out, project.getFile(new Path("basic_lib_missing_inc/class1_2.svh"))); log.debug(">> SLEEP"); // Wait a bit... try { Thread.sleep(2000); } catch (InterruptedException e) { } log.debug("<< SLEEP"); index.loadIndex(new NullProgressMonitor()); IndexTestUtils.assertFileHasElements(fLog, index, "class1", "class1_2"); LogFactory.removeLogHandle(log); }
public void testCovergroupTypeOptionMergeInstances() { String doc = "class my_class1;\n" + // 1 "\n" + " covergroup foo;\n" + " type_option.mer<<MARK>>\n" + " endgroup\n" + "endclass\n"; SVCorePlugin.getDefault().enableDebug(false); Tuple<SVDBFile, TextTagPosUtils> ini = contentAssistSetup(doc); StringBIDITextScanner scanner = new StringBIDITextScanner(ini.second().getStrippedData()); TestCompletionProcessor cp = new TestCompletionProcessor(ini.first(), fIndexMgr); scanner.seek(ini.second().getPosMap().get("MARK")); ISVDBIndexIterator index_it = cp.getIndexIterator(); SVDBIndexValidator v = new SVDBIndexValidator(); v.validateIndex(index_it, SVDBIndexValidator.ExpectErrors); IndexTestUtils.assertFileHasElements(index_it, "my_class1" /*, "my_class1::foo"*/); cp.computeProposals(scanner, ini.first(), ini.second().getLineMap().get("MARK")); List<SVCompletionProposal> proposals = cp.getCompletionProposals(); assertEquals(1, proposals.size()); // TODO: at some point, my_class1 and my_class2 will not be proposals, // since they are types not variables validateResults(new String[] {"merge_instances"}, proposals); }