File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ func (s *set) Add(value string) {
88 s .data [value ] = true
99}
1010
11+ func (s * set ) Remove (value string ) {
12+ delete (s .data , value )
13+ }
14+
1115func (s * set ) Contains (value string ) (exists bool ) {
1216 _ , exists = s .data [value ]
1317 return
Original file line number Diff line number Diff line change 1+ package dbus
2+
3+ import (
4+ "testing"
5+ )
6+
7+ // TestBasicSetActions asserts that Add & Remove behavior is correct
8+ func TestBasicSetActions (t * testing.T ) {
9+ s := set {}
10+
11+ if s .Contains ("foo" ) {
12+ t .Fatal ("set should not contain 'foo'" )
13+ }
14+
15+ s .Add ("foo" )
16+
17+ if ! s .Contains ("foo" ) {
18+ t .Fatal ("set should contain 'foo'" )
19+ }
20+
21+ s .Remove ("foo" )
22+
23+ if s .Contains ("foo" ) {
24+ t .Fatal ("set should not contain 'foo'" )
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments