// +build codegen
package api
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNonHTMLDocGen(t *testing.T) {
doc := "Testing 1 2 3"
expected := "// Testing 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestListsHTMLDocGen(t *testing.T) {
doc := "
"
expected := "// * Testing 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
doc = ""
expected = "// * Testing 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
// Test leading spaces
doc = " "
doc = docstring(doc)
assert.Equal(t, expected, doc)
// Paragraph check
doc = ""
expected = "// * Testing 1 2 3\n// \n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestInlineCodeHTMLDocGen(t *testing.T) {
doc := ""
expected := "// * Testing: 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestInlineCodeInParagraphHTMLDocGen(t *testing.T) {
doc := "Testing
: 1 2 3
"
expected := "// Testing: 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestEmptyPREInlineCodeHTMLDocGen(t *testing.T) {
doc := "Testing
"
expected := "// Testing\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestParagraph(t *testing.T) {
doc := "Testing 1 2 3
"
expected := "// Testing 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestComplexListParagraphCode(t *testing.T) {
doc := ""
expected := "// * FOO Bar\n// \n// * Xyz ABC\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}