(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func 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 | } |
nothing calls this directly
no test coverage detected