/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* Unit tests for JFlexTokenizer.
*/
public class JFlexTokenizerTest {
/**
* Test that the various sub-classes of JFlexTokenizerTest return the
* correct offsets for the tokens. They used to give wrong values for the
* last token. Bug #15858.
*
* @throws java.lang.Exception
*/
@Test
testOffsetAttribute(CSymbolTokenizer.class);
testOffsetAttribute(ShSymbolTokenizer.class);
// The Fortran tokenizer doesn't accept the default input text, so
// create a text fragment that it understands
"1 token1 = token2 + token3",
}
/**
* Helper method for {@link #testOffsetAttribute()} that runs the test on
* one single implementation class.
*/
throws Exception {
}
/**
* Helper method for {@link #testOffsetAttribute()} that runs the test on
* one single implementation class with the specified input text and
* expected tokens.
*/
throws Exception {
int count = 0;
while (tokenizer.incrementToken()) {
assertEquals("start",
assertEquals("end",
count++;
}
}
/**
* The fix for bug #15858 caused a regression in ShSymbolTokenizer where
* variables on the form {@code ${VARIABLE}} were not correctly indexed if
* they were inside a quoted string. The closing brace would be part of the
* indexed term in that case.
*
* @throws java.lang.Exception
*/
@Test
// Shell command to tokenize
// "echo" is an ignored token in ShSymbolTokenizer, "xyz" is a string
// and not a symbol. Therefore, expect just the two tokens that name
// variables.
}
/**
* Truncated uuencoded files used to cause infinite loops. Verify that they
* work now.
*
* @throws java.io.IOException
*/
@Test
new StringReader("begin 644 test\n"));
// This call used to hang forever.
}
}