github.com/anakojm/hugo-katex@v0.0.0-20231023141351-42d6f5de9c0b/hugolib/configdir_test.go (about)

     1  // Copyright 2023 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 hugolib
    15  
    16  import "testing"
    17  
    18  func TestConfigDir(t *testing.T) {
    19  
    20  	t.Parallel()
    21  
    22  	files := `
    23  -- config/_default/params.toml --
    24  a = "acp1"
    25  d = "dcp1"
    26  -- config/_default/config.toml --
    27  [params]
    28  a = "ac1"
    29  b = "bc1"
    30  
    31  -- hugo.toml --
    32  baseURL = "https://example.com"
    33  disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
    34  ignoreErrors = ["error-missing-instagram-accesstoken"]
    35  [params]
    36  a = "a1"
    37  b = "b1"
    38  c = "c1"
    39  -- layouts/index.html --
    40  Params: {{ site.Params}}
    41  `
    42  	b := NewIntegrationTestBuilder(
    43  		IntegrationTestConfig{
    44  			T:           t,
    45  			TxtarString: files,
    46  		},
    47  	).Build()
    48  
    49  	b.AssertFileContent("public/index.html", `
    50  Params: map[a:acp1 b:bc1 c:c1 d:dcp1]
    51  
    52  
    53  `)
    54  
    55  }