/usr/share/gocode/src/github.com/twstrike/otr3/sexp/sexp_test.go is in golang-github-twstrike-otr3-dev 0.0~git20161015.0.744856d-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 47 48 49 50 51 52 53 54 55 56 | package sexp
import (
"bufio"
"bytes"
"testing"
)
func inp(s string) *bufio.Reader {
return bufio.NewReader(bytes.NewBuffer([]byte(s)))
}
func Test_parse_willParseASymbol(t *testing.T) {
result := Read(inp("hello"))
assertDeepEquals(t, result, Symbol("hello"))
}
func Test_parse_willParseAString(t *testing.T) {
result := Read(inp("\"hello\""))
assertDeepEquals(t, result, Sstring("hello"))
}
func Test_parse_willParseABigNum(t *testing.T) {
result := Read(inp("#123FFCADDD#"))
assertDeepEquals(t, result, NewBigNum("123FFCADDD"))
}
func Test_parse_willParseAnEmptyList(t *testing.T) {
result := Read(inp("()"))
assertDeepEquals(t, result, List())
}
func Test_parse_willParseAListWithAnAtom(t *testing.T) {
result := Read(inp("(an-atom)"))
assertDeepEquals(t, result, List(Symbol("an-atom")))
}
func Test_parse_willParseAListWithAString(t *testing.T) {
result := Read(inp("(\"an-atom\")"))
assertDeepEquals(t, result, List(Sstring("an-atom")))
}
func Test_parse_willParseAListWithTwoAtoms(t *testing.T) {
result := Read(inp("(an-atom another-atom)"))
assertDeepEquals(t, result, List(Symbol("an-atom"), Symbol("another-atom")))
}
func Test_parse_willParseAListWithNestedLists(t *testing.T) {
result := Read(inp("(an-atom (another-atom))"))
assertDeepEquals(t, result, List(Symbol("an-atom"), List(Symbol("another-atom"))))
}
func Test_parse_willParseAListWithSeveralLists(t *testing.T) {
result := Read(inp("(an-atom (another-atom) (a-third))"))
assertDeepEquals(t, result, List(Symbol("an-atom"), List(Symbol("another-atom")), List(Symbol("a-third"))))
}
|