~chrisppy/go-barefeed

ref: e76763008dc2b1750154fb00285056605c882e40 go-barefeed/text_test.go -rw-r--r-- 752 bytes
e7676300Chris Palmer fix textType 4 months ago
                                                                                
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
package barefeed

import (
	"testing"
)

func testText(t *testing.T, expected, actual Text) {
	if expected.TextType != actual.TextType {
		t.Errorf("Expected %d, actual %d", expected.TextType, actual.TextType)
	}
	if expected.Value != actual.Value {
		t.Errorf("Expected %s, actual %s", expected.Value, actual.Value)
	}
}

func getText() Text {
	return Text{
		TextType: HTML,
		Value:    "<p>This is a test</p>",
	}
}

func TestTextType(t *testing.T) {
	e := TEXT
	a := ToTextType(e.String())
	if e != a {
		t.Errorf("Expected %d, actual %d", e, a)
	}

	e = HTML
	a = ToTextType(e.String())
	if e != a {
		t.Errorf("Expected %d, actual %d", e, a)
	}

	e = XHTML
	a = ToTextType(e.String())
	if e != a {
		t.Errorf("Expected %d, actual %d", e, a)
	}
}