| 218 | } |
| 219 | |
| 220 | func TestDecodeHalf(t *testing.T) { |
| 221 | for i, tc := range []testCase{ |
| 222 | { |
| 223 | mask: 0, |
| 224 | in: "‛", |
| 225 | out: "‛", |
| 226 | }, { |
| 227 | mask: EncodeZero, |
| 228 | in: "‛‛", |
| 229 | out: "‛", |
| 230 | }, { |
| 231 | mask: 0, |
| 232 | in: "‛a‛", |
| 233 | out: "‛a‛", |
| 234 | }, { |
| 235 | mask: EncodeInvalidUtf8, |
| 236 | in: "a‛B‛Eg", |
| 237 | out: "a‛B‛Eg", |
| 238 | }, { |
| 239 | mask: EncodeInvalidUtf8, |
| 240 | in: "a‛B\‛Eg", |
| 241 | out: "a‛B\‛Eg", |
| 242 | }, { |
| 243 | mask: EncodeInvalidUtf8 | EncodeBackSlash, |
| 244 | in: "a‛B\‛Eg", |
| 245 | out: "a‛B\\‛Eg", |
| 246 | }, |
| 247 | } { |
| 248 | e := tc.mask |
| 249 | t.Run(strconv.FormatInt(int64(i), 10), func(t *testing.T) { |
| 250 | got := e.Decode(tc.in) |
| 251 | if got != tc.out { |
| 252 | t.Errorf("Decode(%q) want %q got %q", tc.in, tc.out, got) |
| 253 | } |
| 254 | }) |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | const oneDrive = (Standard | |
| 259 | EncodeWin | |