File: tests_test.go

package info (click to toggle)
golang-objx 0.0~git20150928.0.1a9d0bb-1~bpo8+1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 324 kB
  • sloc: makefile: 5
file content (24 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package objx

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestHas(t *testing.T) {

	m := New(TestMap)

	assert.True(t, m.Has("name"))
	assert.True(t, m.Has("address.state"))
	assert.True(t, m.Has("numbers[4]"))

	assert.False(t, m.Has("address.state.nope"))
	assert.False(t, m.Has("address.nope"))
	assert.False(t, m.Has("nope"))
	assert.False(t, m.Has("numbers[5]"))

	m = nil
	assert.False(t, m.Has("nothing"))

}