Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: server/config/caching/codec_test.go

Issue 2573403002: server/config: Generic caching backend. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698