4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * CDDL HEADER START
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * The contents of this file are subject to the terms of the
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * Common Development and Distribution License (the "License").
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * You may not use this file except in compliance with the License.
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * See LICENSE.txt included in this distribution for the specific
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * language governing permissions and limitations under the License.
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * When distributing Covered Code, include this CDDL HEADER in each
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * file and include the License file at LICENSE.txt.
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * If applicable, add the following below this CDDL HEADER, with the
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * fields enclosed by brackets "[]" replaced with your own identifying
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * information: Portions Copyright [yyyy] [name of copyright owner]
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * CDDL HEADER END
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonypackage org.opensolaris.opengrok.analysis.pascal;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport static org.opensolaris.opengrok.analysis.AnalyzerGuru.string_ft_nstored_nanalyzed_norms;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.analysis.Definitions;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.analysis.FileAnalyzer;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.analysis.StreamSource;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.configuration.RuntimeEnvironment;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.search.QueryBuilder;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthonyimport org.opensolaris.opengrok.util.TestRepository;
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * @author alexanthony
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony private final String ctagsProperty = "org.opensolaris.opengrok.analysis.Ctags";
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony PascalAnalyzerFactory analyzerFactory = new PascalAnalyzerFactory();
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony RuntimeEnvironment env = RuntimeEnvironment.getInstance();
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony env.setCtags(System.getProperty(ctagsProperty, "ctags"));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony private static StreamSource getStreamSource(final String fname) {
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony return new StreamSource() {
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony public InputStream getStream() throws IOException {
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony public static void setUpClass() throws Exception {
cdf0e447de808476dc7ae748effd07627a24f29eLubos Kosco ctags.setBinary(RuntimeEnvironment.getInstance().getCtags());
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony repository.create(PascalAnalyzerFactoryTest.class.getResourceAsStream(
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony "/org/opensolaris/opengrok/index/source.zip"));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony public static void tearDownClass() throws Exception {
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * Test of writeXref method, of class PascalAnalyzerFactory.
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony * @throws java.lang.Exception
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony String path = repository.getSourceRoot() + "/pascal/Sample.pas";
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony analyzer.analyze(doc, getStreamSource(path), xrefOut);
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony Definitions definitions = Definitions.deserialize(doc.getField(QueryBuilder.TAGS).binaryValue().bytes);
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("Sample", 22, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("TSample", 28, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("Id", 40, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("Description", 41, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("TSample.GetId", 48, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("TSample.SetId", 53, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("TSample.GetClassName", 58, type));
4eeac49e1b7fcd20b9586bbdc636a67f6feed3bfAlex Anthony assertTrue(definitions.hasDefinitionAt("TSample.GetUser", 63, type));