Skip to content

Commit f7ba06a

Browse files
test: Add quarto_render_export test
1 parent a4c351b commit f7ba06a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

quarto/main_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main_test
33
import (
44
"context"
55
"flag"
6+
"fmt"
67
"os"
78
"testing"
89

@@ -29,6 +30,34 @@ func Test_Quarto(t *testing.T) {
2930
t.Parallel()
3031
ctx := context.Background()
3132

33+
t.Run("Test_quarto_render_export", func(t *testing.T) {
34+
t.Parallel()
35+
container := base("ghcr.io/quarto-dev/quarto-full")
36+
require.NotNil(t, container)
37+
38+
out, err := container.
39+
WithDirectory("/tmp", c.Host().Directory("./test/testdata/")).
40+
WithWorkdir("/tmp").
41+
WithExec([]string{"quarto", "render"}).
42+
Directory("/tmp/_book").Sync(ctx)
43+
require.NoError(t, err)
44+
require.NotNil(t, out)
45+
46+
outputDir := "./test/outputdata/"
47+
_, err = out.Export(ctx, outputDir)
48+
require.NoError(t, err)
49+
50+
files, err := os.ReadDir(outputDir)
51+
require.NoError(t, err)
52+
53+
fmt.Println(files)
54+
for _, file := range files {
55+
require.Regexp(t, `\.pdf\s*$`, file)
56+
}
57+
58+
err = os.RemoveAll(outputDir)
59+
require.NoError(t, err)
60+
})
3261
t.Run("Test_quarto_tlmgr_mirror_and_render", func(t *testing.T) {
3362
t.Parallel()
3463
container := base("ghcr.io/quarto-dev/quarto-full")

0 commit comments

Comments
 (0)