/usr/share/gocode/src/github.com/hashicorp/hil/ast/stack_test.go is in golang-github-hashicorp-hil-dev 0.0~git20160326.0.40da60f-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | package ast
import (
"reflect"
"testing"
)
func TestStack(t *testing.T) {
var s Stack
if s.Len() != 0 {
t.Fatalf("bad: %d", s.Len())
}
n := &LiteralNode{Value: 42}
s.Push(n)
if s.Len() != 1 {
t.Fatalf("bad: %d", s.Len())
}
actual := s.Pop()
if !reflect.DeepEqual(actual, n) {
t.Fatalf("bad: %#v", actual)
}
if s.Len() != 0 {
t.Fatalf("bad: %d", s.Len())
}
}
func TestStack_reset(t *testing.T) {
var s Stack
n := &LiteralNode{Value: 42}
s.Push(n)
if s.Len() != 1 {
t.Fatalf("bad: %d", s.Len())
}
s.Reset()
if s.Len() != 0 {
t.Fatalf("bad: %d", s.Len())
}
}
|