aboutsummaryrefslogtreecommitdiff
path: root/tvsaver/saver2v1/util_test.go
blob: aceccb7bbe34678d1b72f8395b806b790ce1285d (plain)
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
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

package saver2v1

import (
	"testing"
)

// ===== Utility function tests =====
func TestTextifyWrapsStringWithNewline(t *testing.T) {
	s := `this text has
a newline in it`
	want := `<text>this text has
a newline in it</text>`

	got := textify(s)

	if want != got {
		t.Errorf("Expected %s, got %s", want, got)
	}
}

func TestTextifyDoesNotWrapsStringWithNoNewline(t *testing.T) {
	s := `this text has no newline in it`
	want := s

	got := textify(s)

	if want != got {
		t.Errorf("Expected %s, got %s", want, got)
	}
}