aboutsummaryrefslogtreecommitdiff
path: root/bencode/bencode_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-12 07:10:39 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-12 07:10:39 +0200
commit92b93449373418da481369078208bd8630d67c41 (patch)
tree27c931c21788abb1f95697f75c0f08a724e0a42f /bencode/bencode_test.go
parentda795ea9b35368a97d63ffe3e1b6866bec23727c (diff)
Add bool values
Diffstat (limited to 'bencode/bencode_test.go')
-rw-r--r--bencode/bencode_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/bencode/bencode_test.go b/bencode/bencode_test.go
index 497cd6f..2a7678f 100644
--- a/bencode/bencode_test.go
+++ b/bencode/bencode_test.go
@@ -20,6 +20,7 @@ func TestMarshal(t *testing.T) {
{Path: []string{"A"}},
{Path: []string{"B"}},
},
+ Private: true,
},
}
out, err := Marshal(v)
@@ -80,3 +81,15 @@ func TestUnmarshal(t *testing.T) {
}
}
}
+
+func TestBoolUnmarshal(t *testing.T) {
+ var b struct{ A bool }
+ in := `d1:Ai1ee`
+ err := Unmarshal([]byte(in), &b)
+ if err != nil {
+ t.Error(err)
+ }
+ if b.A != true {
+ t.Error("expected true, got", b.A)
+ }
+}