"log": func(ts *testscript.TestScript, neg bool, args []string) {
log.Println(args)
},
- // dostounix converts \r\n to \n.
- "dostounix": func(ts *testscript.TestScript, neg bool, args []string) {
- filename := ts.MkAbs(args[0])
- b, err := os.ReadFile(filename)
- if err != nil {
- ts.Fatalf("%v", err)
- }
- b = bytes.Replace(b, []byte("\r\n"), []byte{'\n'}, -1)
- if err := os.WriteFile(filename, b, 0o666); err != nil {
- ts.Fatalf("%v", err)
- }
- },
// cat prints a file to stdout.
"cat": func(ts *testscript.TestScript, neg bool, args []string) {
filename := ts.MkAbs(args[0])
--- /dev/null
+* text=auto eol=lf
# Test the hugo mod commands.
-dostounix golden/vendor.txt
-dostounix golden/go.mod.testsubmod
-
hugo mod graph
stdout 'empty-hugo'
hugo mod verify
# Test the hugo init command.
-dostounix golden/go.mod.testsubmod
hugo mod init testsubmod
cmpenv go.mod $WORK/golden/go.mod.testsubmod
# Test mod npm pack.
-dostounix golden1/package.json
-dostounix golden1/packages/hugoautogen/package.json
-dostounix golden1/packages/hugoautogen/hugo_packagemeta.json
-dostounix golden2/packages/hugoautogen/package.json
-dostounix golden3/packages/hugoautogen/package.json
-dostounix golden4/packages/hugoautogen/package.json
-dostounix golden5/packages/hugoautogen/package.json
-
hugo mod npm pack
cmp packages/hugoautogen/package.json golden1/packages/hugoautogen/package.json
cmp package.json golden1/package.json
# Test mod npm pack with shuffled modules.
-dostounix golden1/package.json
-dostounix golden1/packages/hugoautogen/package.json
-dostounix golden1/packages/hugoautogen/hugo_packagemeta.json
-
hugo mod npm pack
cmp packages/hugoautogen/package.json golden1/packages/hugoautogen/package.json
cmp package.json golden1/package.json
# See https://github.com/gohugoio/hugo/issues/13465
[windows] skip
-dostounix golden/packages/hugoautogen/package.json
-dostounix golden/package.json
-
hugo mod npm pack
cmp packages/hugoautogen/package.json golden/packages/hugoautogen/package.json
cmp package.json golden/package.json
# Test hugo mod tidy.
-dostounix golden/go.mod.cleaned
-
hugo mod tidy
cmp go.mod golden/go.mod.cleaned
-dostounix golden/vendor.txt
-
hugo mod vendor
cmp _vendor/modules.txt golden/vendor.txt
ls _vendor/github.com/gohugoio/hugo-mod-integrationtests/withconfigtoml
-dostounix golden/vendor.txt
-
hugo mod vendor
cmp _vendor/modules.txt golden/vendor.txt
lsr _vendor