MCPcopy
hub / github.com/expr-lang/expr / TestEval_exposed_error

Function TestEval_exposed_error

expr_test.go:1783–1792  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1781}
1782
1783func TestEval_exposed_error(t *testing.T) {
1784 _, err := expr.Eval(`1 % 0`, nil)
1785 require.Error(t, err)
1786
1787 fileError, ok := err.(*file.Error)
1788 require.True(t, ok, "error should be of type *file.Error")
1789 require.Equal(t, "runtime error: integer divide by zero (1:3)\n | 1 % 0\n | ..^", fileError.Error())
1790 require.Equal(t, 2, fileError.Column)
1791 require.Equal(t, 1, fileError.Line)
1792}
1793
1794func TestCompile_exposed_error_with_multiline_script(t *testing.T) {
1795 _, err := expr.Compile("{\n\ta: 1,\n\tb: #,\n\tc: 3,\n}")

Callers

nothing calls this directly

Calls 5

EvalFunction · 0.92
ErrorFunction · 0.92
TrueFunction · 0.92
EqualFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…