| 1 | package model_testscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 5 | |
| 6 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 7 | ) |
| 8 | |
| 9 | func TestValue_IsNullscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestValue_IsNull().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 10 | v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().() |
| 11 | if !v.IsNullscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsNull().() { |
| 12 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatalf().("expected value to be null") |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | func TestStringIndexRangescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model_test`/TestStringIndexRange().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 17 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("positive range", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 18 | v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello") |
| 19 | got, err := v.StringIndexRangescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringIndexRange().(1, 3) |
| 20 | if err != nil { |
| 21 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 22 | } |
| 23 | s, _ := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 24 | if s != "ell" { |
| 25 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'ell', got %q", s) |
| 26 | } |
| 27 | }) |
| 28 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("negative indices", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 29 | v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello") |
| 30 | got, err := v.StringIndexRangescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringIndexRange().(-3, -1) |
| 31 | if err != nil { |
| 32 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 33 | } |
| 34 | s, _ := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 35 | if s != "llo" { |
| 36 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'llo', got %q", s) |
| 37 | } |
| 38 | }) |
| 39 | t.Runscip-go gomod github.com/golang/go/src go1.25 testing/T#Run().("reverse range", func(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 40 | v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().("hello") |
| 41 | got, err := v.StringIndexRangescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringIndexRange().(3, 1) |
| 42 | if err != nil { |
| 43 | t.Fatalscip-go gomod github.com/golang/go/src go1.25 testing/common#Fatal().(err) |
| 44 | } |
| 45 | s, _ := got.StringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#StringValue().() |
| 46 | if s != "lle" { |
| 47 | t.Errorfscip-go gomod github.com/golang/go/src go1.25 testing/common#Errorf().("expected 'lle', got %q", s) |
| 48 | } |
| 49 | }) |
| 50 | } |