Skip to content

Commit

Permalink
Fix sum function so that it doesn't accept errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
anmcgrath committed Mar 2, 2024
1 parent f8f4871 commit 03a38a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BlazorDatasheet.Formula.Functions/Math/SumFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public CellValue Call(CellValue[] args, FunctionCallMetaData metaData)
return CellValue.Number(sum);
}

public bool AcceptsErrors => true;
public bool AcceptsErrors => false;
}
1 change: 1 addition & 0 deletions test/BlazorDatasheet.Test/Functions/MathFunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void Sum_Function_Tests()
_env.RegisterFunction("sum", new SumFunction());
var res1 = Eval("=sum(1, 2)");
res1.Should().Be(3);
Eval("=sum(1/0)").Should().BeOfType<FormulaError>();
Eval("=sum(5)").Should().Be(5);
Eval("=sum(true,true)").Should().Be(2);
Eval("=sum(\"ab\",true)").Should().BeOfType<FormulaError>();
Expand Down

0 comments on commit 03a38a5

Please sign in to comment.