💾 Archived View for anachronauts.club › cgi-bin › repos › cgi › gmikit.git › tree › trunk › gmi_test… captured on 2022-01-08 at 14:05:37. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-05)

-=-=-=-=-=-=-

gmikit.git

git @ anachronauts.club

summary

tree

log

refs

gmikit.git/gmi_test.go | 732 bytes

view raw

 1 package gmikit
 2 
 3 import (
 4 	"strings"
 5 	"testing"
 6 )
 7 
 8 func TestRoundtripEmpty(t *testing.T) {
 9 	expected := ""
10 	input := strings.NewReader(expected)
11 	var output strings.Builder
12 	if err := NormalizeGmi(input, &output); err != nil {
13 		t.Error(err)
14 	}
15 
16 	actual := output.String()
17 	if expected != actual {
18 		t.Errorf("Expected %v got %v", expected, actual)
19 	}
20 }
21 
22 func TestRoundtripComplex(t *testing.T) {
23 	expected := `# Heading 1
24 
25 Text, more text.
26 
27 => hello.gmi Hello!
28 
29 > One
30 > Two
31 > Three
32 `
33 
34 	input := strings.NewReader(expected)
35 	var output strings.Builder
36 	if err := NormalizeGmi(input, &output); err != nil {
37 		t.Error(err)
38 	}
39 
40 	actual := output.String()
41 	if expected != actual {
42 		t.Errorf("Expected %v got %v", expected, actual)
43 	}
44 }