summaryrefslogtreecommitdiff
path: root/calc_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-10-01 21:43:02 +0800
committerxuri <xuri.me@gmail.com>2021-10-01 21:43:02 +0800
commit28841af9804243205a9693be0cb501ce2d980302 (patch)
tree4d09aed52463fce951932d90fd6824dc3e621b54 /calc_test.go
parente52e75528260745d87fb0962fe239f54c1b5b390 (diff)
initialize formula function TRANSPOSE, ref #65 and remove unused exported error variable ErrToExcelTime
Diffstat (limited to 'calc_test.go')
-rw-r--r--calc_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/calc_test.go b/calc_test.go
index 54629a6..a391a19 100644
--- a/calc_test.go
+++ b/calc_test.go
@@ -2217,6 +2217,8 @@ func TestCalcCellValue(t *testing.T) {
"=MATCH(0,A1:A1,\"x\")": "MATCH requires numeric match_type argument",
"=MATCH(0,A1)": "MATCH arguments lookup_array should be one-dimensional array",
"=MATCH(0,A1:B1)": "MATCH arguments lookup_array should be one-dimensional array",
+ // TRANSPOSE
+ "=TRANSPOSE()": "TRANSPOSE requires 1 argument",
// VLOOKUP
"=VLOOKUP()": "VLOOKUP requires at least 3 arguments",
"=VLOOKUP(D2,D1,1,FALSE)": "VLOOKUP requires second argument of table array",
@@ -2611,6 +2613,21 @@ func TestCalcMatchPattern(t *testing.T) {
assert.False(t, matchPattern("file/?", "file/abc/bcd/def"))
}
+func TestCalcTRANSPOSE(t *testing.T) {
+ cellData := [][]interface{}{
+ {"a", "d"},
+ {"b", "e"},
+ {"c", "f"},
+ }
+ formula := "=TRANSPOSE(A1:A3)"
+ f := prepareCalcData(cellData)
+ formulaType, ref := STCellFormulaTypeArray, "D1:F2"
+ assert.NoError(t, f.SetCellFormula("Sheet1", "D1", formula,
+ FormulaOpts{Ref: &ref, Type: &formulaType}))
+ _, err := f.CalcCellValue("Sheet1", "D1")
+ assert.NoError(t, err, formula)
+}
+
func TestCalcVLOOKUP(t *testing.T) {
cellData := [][]interface{}{
{nil, nil, nil, nil, nil, nil},