diff options
author | Josh Micich <josh@apache.org> | 2009-02-02 23:10:30 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-02-02 23:10:30 +0000 |
commit | abdf3c9c46982d67045eced1b009bbcaa152b692 (patch) | |
tree | 818fa828b118892e89f976043ebd4b32559cf274 /src/testcases | |
parent | b120173f631eead7427081dfcaca92813a40fb33 (diff) | |
download | poi-abdf3c9c46982d67045eced1b009bbcaa152b692.tar.gz poi-abdf3c9c46982d67045eced1b009bbcaa152b692.zip |
Fix for bug 46643 - formula parser should encode range operator with tMemFunc
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@740146 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java index b951ae3b62..a6ff9fd519 100644 --- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java +++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java @@ -45,6 +45,7 @@ import org.apache.poi.hssf.record.formula.NumberPtg; import org.apache.poi.hssf.record.formula.PercentPtg; import org.apache.poi.hssf.record.formula.PowerPtg; import org.apache.poi.hssf.record.formula.Ptg; +import org.apache.poi.hssf.record.formula.RangePtg; import org.apache.poi.hssf.record.formula.Ref3DPtg; import org.apache.poi.hssf.record.formula.RefPtg; import org.apache.poi.hssf.record.formula.StringPtg; @@ -973,4 +974,26 @@ public final class TestFormulaParser extends TestCase { MemFuncPtg mf = (MemFuncPtg)ptgs[0]; assertEquals(45, mf.getLenRefSubexpression()); } + + public void testRange_bug46643() { + String formula = "Sheet1!A1:Sheet1!B3"; + HSSFWorkbook wb = new HSSFWorkbook(); + wb.createSheet("Sheet1"); + Ptg[] ptgs = FormulaParser.parse(formula, HSSFEvaluationWorkbook.create(wb)); + + if (ptgs.length == 3) { + confirmTokenClasses(ptgs, new Class[] { Ref3DPtg.class, Ref3DPtg.class, RangePtg.class,}); + throw new AssertionFailedError("Identified bug 46643"); + } + + Class [] expectedClasses = { + MemFuncPtg.class, + Ref3DPtg.class, + Ref3DPtg.class, + RangePtg.class, + }; + confirmTokenClasses(ptgs, expectedClasses); + MemFuncPtg mf = (MemFuncPtg)ptgs[0]; + assertEquals(15, mf.getLenRefSubexpression()); + } } |