summaryrefslogtreecommitdiff
path: root/calc_test.go
diff options
context:
space:
mode:
authorjaby <peter.de.velder@ilias-solutions.com>2021-12-10 09:48:02 +0100
committerGitHub <noreply@github.com>2021-12-10 16:48:02 +0800
commitb33e39369aa3898d2f6e079240545f9d84abec73 (patch)
tree6ba844451416c6a5407b1411d0ff3143038563b9 /calc_test.go
parent1b3040659d3155732961c45b0c2e13e39e0b2576 (diff)
This closes #1090 (#1092)
Keep track of operators per function
Diffstat (limited to 'calc_test.go')
-rw-r--r--calc_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/calc_test.go b/calc_test.go
index 50f8023..a2b1294 100644
--- a/calc_test.go
+++ b/calc_test.go
@@ -3787,3 +3787,23 @@ func TestGetYearDays(t *testing.T) {
assert.Equal(t, data[2], getYearDays(data[0], data[1]))
}
}
+
+func TestNestedFunctionsWithOperators(t *testing.T) {
+ f := NewFile()
+ formulaList := map[string]string{
+ `=LEN("KEEP")`: "4",
+ `=LEN("REMOVEKEEP") - LEN("REMOVE")`: "4",
+ `=RIGHT("REMOVEKEEP", 4)`: "KEEP",
+ `=RIGHT("REMOVEKEEP", 10 - 6))`: "KEEP",
+ `=RIGHT("REMOVEKEEP", LEN("REMOVEKEEP") - 6)`: "KEEP",
+ `=RIGHT("REMOVEKEEP", LEN("REMOVEKEEP") - LEN("REMOV") - 1)`: "KEEP",
+ `=RIGHT("REMOVEKEEP", 10 - LEN("REMOVE"))`: "KEEP",
+ `=RIGHT("REMOVEKEEP", LEN("REMOVEKEEP") - LEN("REMOVE"))`: "KEEP",
+ }
+ for formula, expected := range formulaList {
+ assert.NoError(t, f.SetCellFormula("Sheet1", "E1", formula))
+ result, err := f.CalcCellValue("Sheet1", "E1")
+ assert.NoError(t, err, formula)
+ assert.Equal(t, expected, result, formula)
+ }
+}