Debian Codegraph @

execution/options_test.go

raw symbols SCIP
1 package execution_test
2
3 import (
4 "testing"
5
6 "github.com/tomwright/dasel/v3/execution"
7 )
8
9 func TestOptions(t *testing.T) {
10 t.Run("WithFuncs", func(t *testing.T) {
11 fc := execution.DefaultFuncCollection.Copy()
12 opts := execution.NewOptions(execution.WithFuncs(fc))
13 if _, ok := opts.Funcs.Get("len"); !ok {
14 t.Error("expected funcs to contain 'len'")
15 }
16 })
17
18 t.Run("WithoutUnstable", func(t *testing.T) {
19 opts := execution.NewOptions(execution.WithUnstable(), execution.WithoutUnstable())
20 if opts.Unstable {
21 t.Error("expected unstable to be false")
22 }
23 })
24 }
25
26 func TestFuncCollection(t *testing.T) {
27 t.Run("Copy", func(t *testing.T) {
28 fc := execution.DefaultFuncCollection.Copy()
29 if _, ok := fc.Get("len"); !ok {
30 t.Error("expected copy to contain 'len'")
31 }
32 })
33
34 t.Run("Delete", func(t *testing.T) {
35 fc := execution.DefaultFuncCollection.Copy()
36 fc.Delete("len")
37 if _, ok := fc.Get("len"); ok {
38 t.Error("expected len to be deleted")
39 }
40 })
41 }