Debian Codegraph @

modules/modules_integration_test.go

raw ◀ ▶
1 Debian patch touch this file
1 // Copyright 2025 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 modules_test
15
16 import (
17 "testing"
18
19 "github.com/gohugoio/hugo/hugolib"
20 )
21
22 func TestModuleImportWithVersion(t *testing.T) {
•23 t.Skip("This tests needs internet access")
24 t.Parallel()
25
26 files := `
27 -- hugo.toml --
28 baseURL = "https://example.org"
29 [[module.imports]]
30 path = "github.com/bep/hugo-mod-misc/dummy-content"
31 version = "v0.2.0"
32 [[module.imports]]
33 path = "github.com/bep/hugo-mod-misc/dummy-content"
34 version = "v0.1.0"
35 [[module.imports.mounts]]
36 source = "content"
37 target = "content/v1"
38 -- layouts/all.html --
39 Title: {{ .Title }}|Summary: {{ .Summary }}|
40 Deps: {{ range hugo.Deps}}{{ printf "%s@%s" .Path .Version }}|{{ end }}$
41
42 `
43
44 b := hugolib.Test(t, files, hugolib.TestOptWithOSFs())
45
46 b.AssertFileContent("public/index.html", "Deps: project@|github.com/bep/hugo-mod-misc/[email protected]|github.com/bep/hugo-mod-misc/[email protected]|$")
47
48 b.AssertFileContent("public/blog/music/autumn-leaves/index.html", "Autumn Leaves is a popular jazz standard") // v0.2.0
49 b.AssertFileContent("public/v1/blog/music/autumn-leaves/index.html", "Lorem markdownum, placidi peremptis") // v0.1.0
50 }