Skip to content

Commit

Permalink
test: tooctal function in error state
Browse files Browse the repository at this point in the history
  • Loading branch information
42atomys committed May 9, 2024
1 parent e787e90 commit 421df0b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions conversion_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ func TestToFloat64(t *testing.T) {
runTestCases(t, tests)
}

func TestToDecimal(t *testing.T) {
func TestToOctal(t *testing.T) {
var tests = testCases{
{"TestInt", `{{$v := toDecimal .V }}{{typeOf $v}}-{{$v}}`, "int64-511", map[string]any{"V": 777}},
{"TestInt32", `{{$v := toDecimal .V }}{{typeOf $v}}-{{$v}}`, "int64-504", map[string]any{"V": int32(770)}},
{"TestString", `{{$v := toDecimal .V }}{{typeOf $v}}-{{$v}}`, "int64-1", map[string]any{"V": "1"}},
{"TestInt", `{{$v := toOctal .V }}{{typeOf $v}}-{{$v}}`, "int64-511", map[string]any{"V": 777}},
{"TestInt32", `{{$v := toOctal .V }}{{typeOf $v}}-{{$v}}`, "int64-504", map[string]any{"V": int32(770)}},
{"TestString", `{{$v := toOctal .V }}{{typeOf $v}}-{{$v}}`, "int64-1", map[string]any{"V": "1"}},
{"TestInvalid", `{{$v := toOctal .V }}{{typeOf $v}}-{{$v}}`, "int64-0", map[string]any{"V": 1.1}},
}

runTestCases(t, tests)
Expand Down

0 comments on commit 421df0b

Please sign in to comment.