| 1 | package execution_test |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/tomwright/dasel/v3/model" |
| 7 | ) |
| 8 | |
| 9 | func TestFuncStartsWith(t *testing.T) { |
| 10 | t.Run("chained true", testCase{ |
| 11 | s: `"hello world".startsWith("hello")`, |
| 12 | out: model.NewBoolValue(true), |
| 13 | }.run) |
| 14 | t.Run("chained false", testCase{ |
| 15 | s: `"hello world".startsWith("world")`, |
| 16 | out: model.NewBoolValue(false), |
| 17 | }.run) |
| 18 | t.Run("arg input", testCase{ |
| 19 | s: `startsWith("hello world", "hello")`, |
| 20 | out: model.NewBoolValue(true), |
| 21 | }.run) |
| 22 | t.Run("empty prefix", testCase{ |
| 23 | s: `"hello".startsWith("")`, |
| 24 | out: model.NewBoolValue(true), |
| 25 | }.run) |
| 26 | } |