Skip to content

Commit c38633a

Browse files
committed
add basic integrations tests to pandoc
1 parent 35461c1 commit c38633a

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

markup/pandoc/integration_test.go

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2021 The Hugo Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
package pandoc_test
15+
16+
import (
17+
"testing"
18+
19+
"github.com/gohugoio/hugo/hugolib"
20+
)
21+
22+
func TestBasicConversion(t *testing.T) {
23+
t.Parallel()
24+
25+
files := `
26+
-- config.toml --
27+
-- content/p1.md --
28+
testContent
29+
-- layouts/_default/single.html --
30+
{{ .Content }}
31+
`
32+
b := hugolib.NewIntegrationTestBuilder(
33+
hugolib.IntegrationTestConfig{
34+
T: t,
35+
TxtarString: files,
36+
NeedsOsFS: true,
37+
},
38+
).Build()
39+
40+
b.AssertFileContent("public/p1/index.html", `<p>testContent</p>`)
41+
}
42+
43+
func TestConversionWithHeader(t *testing.T) {
44+
t.Parallel()
45+
46+
files := `
47+
-- config.toml --
48+
-- content/p1.md --
49+
# testContent
50+
-- layouts/_default/single.html --
51+
{{ .Content }}
52+
`
53+
b := hugolib.NewIntegrationTestBuilder(
54+
hugolib.IntegrationTestConfig{
55+
T: t,
56+
TxtarString: files,
57+
NeedsOsFS: true,
58+
},
59+
).Build()
60+
61+
b.AssertFileContent("public/p1/index.html", `<h1 id="testcontent">testContent</h1>`)
62+
}

0 commit comments

Comments
 (0)