Test a few more cases of function INDIRECT()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1754675 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bbfb783a57
commit
98401573ed
@ -27,6 +27,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow;
|
|||||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.apache.poi.ss.formula.eval.ErrorEval;
|
import org.apache.poi.ss.formula.eval.ErrorEval;
|
||||||
|
import org.apache.poi.ss.formula.eval.ValueEval;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellType;
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
import org.apache.poi.ss.usermodel.CellValue;
|
import org.apache.poi.ss.usermodel.CellValue;
|
||||||
@ -105,6 +106,7 @@ public final class TestIndirect {
|
|||||||
|
|
||||||
// non-error cases
|
// non-error cases
|
||||||
confirm(feA, c, "INDIRECT(\"C2\")", 23);
|
confirm(feA, c, "INDIRECT(\"C2\")", 23);
|
||||||
|
confirm(feA, c, "INDIRECT(\"C2\", TRUE)", 23);
|
||||||
confirm(feA, c, "INDIRECT(\"$C2\")", 23);
|
confirm(feA, c, "INDIRECT(\"$C2\")", 23);
|
||||||
confirm(feA, c, "INDIRECT(\"C$2\")", 23);
|
confirm(feA, c, "INDIRECT(\"C$2\")", 23);
|
||||||
confirm(feA, c, "SUM(INDIRECT(\"Sheet2!B1:C3\"))", 351); // area ref
|
confirm(feA, c, "SUM(INDIRECT(\"Sheet2!B1:C3\"))", 351); // area ref
|
||||||
@ -149,7 +151,7 @@ public final class TestIndirect {
|
|||||||
// confirm(feA, c, "INDIRECT(\"Sheet1!A65537\")", ErrorEval.REF_INVALID); // bad row
|
// confirm(feA, c, "INDIRECT(\"Sheet1!A65537\")", ErrorEval.REF_INVALID); // bad row
|
||||||
// }
|
// }
|
||||||
confirm(feA, c, "INDIRECT(\"Sheet1!A 1\")", ErrorEval.REF_INVALID); // space in cell ref
|
confirm(feA, c, "INDIRECT(\"Sheet1!A 1\")", ErrorEval.REF_INVALID); // space in cell ref
|
||||||
|
|
||||||
wbA.close();
|
wbA.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,4 +205,9 @@ public final class TestIndirect {
|
|||||||
+ "' but got '" + cv.formatAsString() + "'.");
|
+ "' but got '" + cv.formatAsString() + "'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInvalidInput() {
|
||||||
|
assertEquals(ErrorEval.VALUE_INVALID, Indirect.instance.evaluate(new ValueEval[] {}, null));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user