-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathstring_test.go
52 lines (39 loc) · 1.26 KB
/
string_test.go
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
47
48
49
50
51
52
// Copyright 2014 SteelSeries ApS. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//This package implements a basic LISP interpretor for embedding in a go program for scripting.
// This file implements tests for string atoms.
package golisp
import (
. "gopkg.in/check.v1"
)
type StringAtomSuite struct {
atom *Data
}
var _ = Suite(&StringAtomSuite{})
func (s *StringAtomSuite) SetUpTest(c *C) {
s.atom = StringWithValue("Hello, world.")
}
func (s *StringAtomSuite) TestIntegerValue(c *C) {
c.Assert(IntegerValue(s.atom), Equals, int64(0))
}
func (s *StringAtomSuite) TestString(c *C) {
c.Assert(String(s.atom), Equals, `"Hello, world."`)
}
func (s *StringAtomSuite) TestStringValue(c *C) {
c.Assert(StringValue(s.atom), Equals, `Hello, world.`)
}
func (s *StringAtomSuite) TestStringValueOfNil(c *C) {
c.Assert(StringValue(nil), Equals, ``)
}
func (s *StringAtomSuite) TestStringValueOfNonString(c *C) {
c.Assert(StringValue(IntegerWithValue(42)), Equals, ``)
}
func (s *StringAtomSuite) TestEval(c *C) {
d, err := Eval(s.atom, Global)
c.Assert(err, IsNil)
c.Assert(d, Equals, s.atom)
}
func (s *StringAtomSuite) TestBooleanValue(c *C) {
c.Assert(BooleanValue(s.atom), Equals, true)
}