1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 3package saver2v2 4 5import ( 6 "testing" 7) 8 9// ===== Utility function tests ===== 10func TestTextifyWrapsStringWithNewline(t *testing.T) { 11 s := `this text has 12a newline in it` 13 want := `<text>this text has 14a newline in it</text>` 15 16 got := textify(s) 17 18 if want != got { 19 t.Errorf("Expected %s, got %s", want, got) 20 } 21} 22 23func TestTextifyDoesNotWrapsStringWithNoNewline(t *testing.T) { 24 s := `this text has no newline in it` 25 want := s 26 27 got := textify(s) 28 29 if want != got { 30 t.Errorf("Expected %s, got %s", want, got) 31 } 32} 33