Skip to content

Commit

Permalink
go-multimap: Move interface assertions to test files
Browse files Browse the repository at this point in the history
Add explicit call to check that slicemultimap and setmultimap implements
the multimap interface.
  • Loading branch information
jwangsadinata committed Mar 25, 2018
1 parent d4d888c commit 90f76c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 0 additions & 4 deletions setmultimap/setmultimap.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ package setmultimap

import multimap "github.com/jwangsadinata/go-multimap"

func assertMultiMapImplementation() {
var _ multimap.MultiMap = (*MultiMap)(nil)
}

var exists = struct{}{}

// Set represents a set object
Expand Down
4 changes: 4 additions & 0 deletions setmultimap/setmultimap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
multimap "github.com/jwangsadinata/go-multimap"
)

func AssertMultiMapImplementation(t *testing.T) {
var _ multimap.MultiMap = New()
}

func TestClear(t *testing.T) {
m := New()
m.Put(5, "e")
Expand Down
6 changes: 1 addition & 5 deletions slicemultimap/slicemultimap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
//
// This multimap is typically known as ListMultimap in other languages.
//
// Elements are unordered in the map
// Elements are unordered in the map.
//
// Structure is not thread safe.
//
package slicemultimap

import multimap "github.com/jwangsadinata/go-multimap"

func assertMultiMapImplementation() {
var _ multimap.MultiMap = (*MultiMap)(nil)
}

// MultiMap holds the elements in go's native map.
type MultiMap struct {
m map[interface{}][]interface{}
Expand Down
4 changes: 4 additions & 0 deletions slicemultimap/slicemultimap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
multimap "github.com/jwangsadinata/go-multimap"
)

func AssertMultiMapImplementation(t *testing.T) {
var _ multimap.MultiMap = New()
}

func TestClear(t *testing.T) {
m := New()
m.Put(5, "e")
Expand Down

0 comments on commit 90f76c4

Please sign in to comment.