MCPcopy Create free account
hub / github.com/apache/devlake / Test_stripZeroByte

Function Test_stripZeroByte

backend/helpers/pluginhelper/api/batch_save_test.go:24–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func Test_stripZeroByte(t *testing.T) {
25 type foo struct {
26 Field string
27 FromString string
28 ToString string
29 From *string
30 }
31 from := "Earth\u0000"
32 type args struct {
33 ifc interface{}
34 }
35 tests := []struct {
36 name string
37 args args
38 }{
39 {
40 name: "Test_stripZeroByte",
41 args: args{
42 ifc: &foo{
43 Field: "home\u0000",
44 FromString: "Earth",
45 ToString: "Mars\u0000",
46 From: &from,
47 },
48 },
49 },
50 }
51 for _, tt := range tests {
52 t.Run(tt.name, func(t *testing.T) {
53 stripZeroByte(tt.args.ifc)
54 if tt.args.ifc.(*foo).Field != "home" {
55 t.Errorf("stripZeroByte() = %v, want %v", tt.args.ifc.(*foo).Field, "home")
56 }
57 if tt.args.ifc.(*foo).FromString != "Earth" {
58 t.Errorf("stripZeroByte() = %v, want %v", tt.args.ifc.(*foo).FromString, "Earth")
59 }
60 if tt.args.ifc.(*foo).ToString != "Mars" {
61 t.Errorf("stripZeroByte() = %v, want %v", tt.args.ifc.(*foo).ToString, "Mars")
62 }
63 if *tt.args.ifc.(*foo).From != from {
64 t.Errorf("stripZeroByte() = %v, want %v", *tt.args.ifc.(*foo).From, "Earth")
65 }
66 })
67 }
68}

Callers

nothing calls this directly

Calls 2

stripZeroByteFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected