| 1 | package execution_test |
| 2 | |
| 3 | import ( |
| 4 | "github.com/tomwright/dasel/v3/model" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestFuncToInt(t *testing.T) { |
| 9 | t.Run("string", testCase{ |
| 10 | s: `toInt("2")`, |
| 11 | out: model.NewIntValue(2), |
| 12 | }.run) |
| 13 | t.Run("int", testCase{ |
| 14 | s: `toInt(1)`, |
| 15 | out: model.NewIntValue(1), |
| 16 | }.run) |
| 17 | t.Run("float", testCase{ |
| 18 | s: `toInt(1.1)`, |
| 19 | out: model.NewIntValue(1), |
| 20 | }.run) |
| 21 | t.Run("bool", testCase{ |
| 22 | s: `toInt(true)`, |
| 23 | out: model.NewIntValue(1), |
| 24 | }.run) |
| 25 | } |