| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package objabi |
| 6 |
|
| 7 |
import "testing" |
| 8 |
|
| 9 |
func TestDecodeArg(t *testing.T) { |
| 10 |
t.Parallel() |
| 11 |
tests := []struct { |
| 12 |
arg, want string |
| 13 |
}{ |
| 14 |
{"", ""}, |
| 15 |
{"hello", "hello"}, |
| 16 |
{"hello\\n", "hello\n"}, |
| 17 |
{"hello\\nthere", "hello\nthere"}, |
| 18 |
{"hello\\\\there", "hello\\there"}, |
| 19 |
{"\\\\\\n", "\\\n"}, |
| 20 |
} |
| 21 |
for _, test := range tests { |
| 22 |
if got := DecodeArg(test.arg); got != test.want { |
| 23 |
t.Errorf("decodoeArg(%q) = %q, want %q", test.arg, got, test.want) |
| 24 |
} |
| 25 |
} |
| 26 |
} |