Debian Codegraph @

execution/execute_branch_test.go

raw symbols SCIP
1 package execution_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.25 testing/"
5
6 "github.com/tomwright/dasel/v3/executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/"
7 "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/"
8 )
9
10 func TestBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/TestBranch().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) {
11 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("single branch", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
12 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: "branch(1)",
13 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
14 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
15 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
16 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)); err != nil {
17 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
18 }
19 return r
20 },
21 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
22 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
23 },
24 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
25 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("many branches", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
26 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: "branch(1, 1+1, 3/1, 123)",
27 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
28 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
29 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
30 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)); err != nil {
31 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
32 }
33 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2)); err != nil {
34 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
35 }
36 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(3)); err != nil {
37 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
38 }
39 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(123)); err != nil {
40 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
41 }
42 return r
43 },
44 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
45 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
46 },
47 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
48 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("spread into many branches", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
49 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: "[1,2,3].branch(...)",
50 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
51 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
52 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
53 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)); err != nil {
54 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
55 }
56 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2)); err != nil {
57 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
58 }
59 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(3)); err != nil {
60 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
61 }
62 return r
63 },
64 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
65 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
66 },
67 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
68 //t.Run("chained branch set", testCase{
69 // s: "branch(1, 2, 3).=5",
70 // outFn: func() *model.Value {
71 // r := model.NewSliceValue()
72 // r.MarkAsBranch()
73 // if err := r.Append(model.NewIntValue(5)); err != nil {
74 // t.Fatalf("unexpected error: %v", err)
75 // }
76 // if err := r.Append(model.NewIntValue(5)); err != nil {
77 // t.Fatalf("unexpected error: %v", err)
78 // }
79 // if err := r.Append(model.NewIntValue(5)); err != nil {
80 // t.Fatalf("unexpected error: %v", err)
81 // }
82 // return r
83 // },
84 // opts: []execution.ExecuteOptionFn{
85 // execution.WithUnstable(),
86 // },
87 //}.run)
88 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("chained branch math", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
89 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: "(branch(1, 2, 3)) * 2",
90 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
91 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
92 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
93 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2)); err != nil {
94 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
95 }
96 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(4)); err != nil {
97 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
98 }
99 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(6)); err != nil {
100 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
101 }
102 return r
103 },
104 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
105 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
106 },
107 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
108 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("chained branch math using branched value", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
109 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: `branch({"x":1}, {"x":2}, {"x":3}).x * $this`,
110 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
111 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
112 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
113 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(1)); err != nil {
114 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
115 }
116 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(4)); err != nil {
117 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
118 }
119 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(9)); err != nil {
120 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
121 }
122 return r
123 },
124 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
125 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
126 },
127 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
128 t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("map on branch", testCasescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#{
129 sscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#s.: `branch([1], [2], [3]).map($this * 2).branch()`,
130 outFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#outFn.: func() *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value# {
131 r := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
132 r.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().()
133 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(2)); err != nil {
134 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
135 }
136 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(4)); err != nil {
137 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
138 }
139 if err := r.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(6)); err != nil {
140 t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("unexpected error: %v", err)
141 }
142 return r
143 },
144 optsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#opts.: []executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.ExecuteOptionFnscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteOptionFn#{
145 executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/.WithUnstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithUnstable().(),
146 },
147 }.runscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution_test`/testCase#run().)
148 }