| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package caching |
| 6 |
| 7 import ( |
| 8 "testing" |
| 9 |
| 10 . "github.com/smartystreets/goconvey/convey" |
| 11 ) |
| 12 |
| 13 func TestHashParams(t *testing.T) { |
| 14 t.Parallel() |
| 15 |
| 16 Convey(`Testing HashParams`, t, func() { |
| 17 // Can't cheat w/ strings including "\x00" (escaping). |
| 18 // |
| 19 // Without escaping: |
| 20 // ["A\x00B"] => A 0x00 B 0x00 |
| 21 // ["A" "B"] => A 0x00 B 0x00 |
| 22 So(HashParams("A\x00B"), ShouldNotResemble, HashParams("A", "B")
) |
| 23 |
| 24 // Can't cheat with different lengths (length prefix). |
| 25 // |
| 26 // After escaping, but with no length prefix: |
| 27 // ["A\x00" ""] => A 0x00 0x00 0x00 0x00 |
| 28 // ["A" "" "" ""] => A 0x00 0x00 0x00 0x00 |
| 29 So(HashParams("A\x00", ""), ShouldNotResemble, HashParams("A", "
", "", "")) |
| 30 }) |
| 31 } |
| OLD | NEW |