mirror of https://github.com/apache/poi.git
Bug 66401: Handle escaped single-quote in formulas properly
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
971ff37eec
commit
7ba2f0fffa
|
@ -1182,6 +1182,7 @@ public final class FormulaParser {
|
|||
if (look == '\''){
|
||||
// Any single quotes which were already present in the sheet name will be converted to double single quotes ('')
|
||||
// so switch back to single quote
|
||||
sb.appendCodePoint(look);
|
||||
nextChar();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -645,7 +645,7 @@ final class TestFormulaParser {
|
|||
assertEquals(expectedClasses.length, ptgs.length);
|
||||
for (int i = 0; i < expectedClasses.length; i++) {
|
||||
assertSame(expectedClasses[i], ptgs[i].getClass(),
|
||||
"difference at token[" + i + "]: expected ("
|
||||
"difference at token[" + i + "] for Ptg " + ptgs[i] + ": expected ("
|
||||
+ expectedClasses[i].getName() + ") but got ("
|
||||
+ ptgs[i].getClass().getName() + ")");
|
||||
}
|
||||
|
@ -1357,6 +1357,17 @@ final class TestFormulaParser {
|
|||
UnionPtg.class
|
||||
);
|
||||
|
||||
wb.createSheet("Sh't1");
|
||||
ptgs = parse("'Sh''t1'!$A:$A,'Sh''t1'!$1:$4", wb);
|
||||
confirmTokenClasses(ptgs,
|
||||
MemFuncPtg.class,
|
||||
Area3DPtg.class,
|
||||
Area3DPtg.class,
|
||||
UnionPtg.class
|
||||
);
|
||||
assertEquals(1, ((Area3DPtg)ptgs[1]).getExternSheetIndex());
|
||||
assertEquals(1, ((Area3DPtg)ptgs[2]).getExternSheetIndex());
|
||||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Date: 10/24/11
|
||||
*/
|
||||
class TestFormulaParser {
|
||||
@Test
|
||||
void testParse(){
|
||||
|
|
Loading…
Reference in New Issue