// +build 1.6,codegen package api import ( "testing" ) func TestNonHTMLDocGen(t *testing.T) { doc := "Testing 1 2 3" expected := "// Testing 1 2 3\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestListsHTMLDocGen(t *testing.T) { doc := "" expected := "// * Testing 1 2 3\n// * FooBar\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } doc = "" expected = "// * Testing 1 2 3\n// * FooBar\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } // Test leading spaces doc = " " doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } // Paragraph check doc = "" expected = "// * Testing 1 2 3\n// \n// * FooBar\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestInlineCodeHTMLDocGen(t *testing.T) { doc := "" expected := "// * Testing: 1 2 3\n// * FooBar\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestInlineCodeInParagraphHTMLDocGen(t *testing.T) { doc := "

Testing: 1 2 3

" expected := "// Testing: 1 2 3\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestEmptyPREInlineCodeHTMLDocGen(t *testing.T) { doc := "
Testing
" expected := "// Testing\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestParagraph(t *testing.T) { doc := "

Testing 1 2 3

" expected := "// Testing 1 2 3\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } } func TestComplexListParagraphCode(t *testing.T) { doc := "" expected := "// * FOO Bar\n// \n// * Xyz ABC\n" doc = docstring(doc) if expected != doc { t.Errorf("Expected %s, but received %s", expected, doc) } }