File: str_test.go

package info (click to toggle)
golang-github-twstrike-otr3 0.0~git20161015.0.744856d-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,080 kB
  • sloc: ansic: 127; makefile: 76
file content (37 lines) | stat: -rw-r--r-- 979 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
25
26
27
28
29
30
31
32
33
34
35
36
37
package sexp

import (
	"bufio"
	"bytes"
	"testing"
)

func Test_Sstring_First_generatesAPanic(t *testing.T) {
	defer checkForPanic(t, "not valid to call First on an SString")
	Sstring("ABCD").First()
}

func Test_Sstring_Second_generatesAPanic(t *testing.T) {
	defer checkForPanic(t, "not valid to call Second on an SString")
	Sstring("ABCD").Second()
}

func Test_Sstring_Value_returnsTheStringRepresentation(t *testing.T) {
	res := Sstring("ABB").Value()
	assertDeepEquals(t, res, "ABB")
}

func Test_Sstring_String_returnsTheStringRepresentation(t *testing.T) {
	res := Sstring("ABB").String()
	assertDeepEquals(t, res, "\"ABB\"")
}

func Test_ReadString_returnsNilIfAskedToReadNonString(t *testing.T) {
	res := ReadString(bufio.NewReader(bytes.NewReader([]byte("a"))))
	assertEquals(t, res, nil)
}

func Test_ReadString_returnsNilIfAskedToReadNonFinishedString(t *testing.T) {
	res := ReadString(bufio.NewReader(bytes.NewReader([]byte("\"a"))))
	assertEquals(t, res, nil)
}