github.com/neohugo/neohugo@v0.123.8/common/htime/htime_integration_test.go (about) 1 // Copyright 2024 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 htime_test 15 16 import ( 17 "testing" 18 19 "github.com/neohugo/neohugo/hugolib" 20 ) 21 22 // Issue #11267 23 func TestApplyWithContext(t *testing.T) { 24 t.Parallel() 25 26 files := ` 27 -- config.toml -- 28 defaultContentLanguage = 'it' 29 -- layouts/index.html -- 30 {{ $dates := slice 31 "2022-01-03" 32 "2022-02-01" 33 "2022-03-02" 34 "2022-04-07" 35 "2022-05-06" 36 "2022-06-04" 37 "2022-07-03" 38 "2022-08-01" 39 "2022-09-06" 40 "2022-10-05" 41 "2022-11-03" 42 "2022-12-02" 43 }} 44 {{ range $dates }} 45 {{ . | time.Format "month: _January_ weekday: _Monday_" }} 46 {{ . | time.Format "month: _Jan_ weekday: _Mon_" }} 47 {{ end }} 48 ` 49 50 b := hugolib.Test(t, files) 51 52 b.AssertFileContent("public/index.html", ` 53 month: _gennaio_ weekday: _lunedì_ 54 month: _gen_ weekday: _lun_ 55 month: _febbraio_ weekday: _martedì_ 56 month: _feb_ weekday: _mar_ 57 month: _marzo_ weekday: _mercoledì_ 58 month: _mar_ weekday: _mer_ 59 month: _aprile_ weekday: _giovedì_ 60 month: _apr_ weekday: _gio_ 61 month: _maggio_ weekday: _venerdì_ 62 month: _mag_ weekday: _ven_ 63 month: _giugno_ weekday: _sabato_ 64 month: _giu_ weekday: _sab_ 65 month: _luglio_ weekday: _domenica_ 66 month: _lug_ weekday: _dom_ 67 month: _agosto_ weekday: _lunedì_ 68 month: _ago_ weekday: _lun_ 69 month: _settembre_ weekday: _martedì_ 70 month: _set_ weekday: _mar_ 71 month: _ottobre_ weekday: _mercoledì_ 72 month: _ott_ weekday: _mer_ 73 month: _novembre_ weekday: _giovedì_ 74 month: _nov_ weekday: _gio_ 75 month: _dicembre_ weekday: _venerdì_ 76 month: _dic_ weekday: _ven_ 77 `) 78 }