...

Source file src/github.com/noirbizarre/gonja/ext/time/time_test.go

Documentation: github.com/noirbizarre/gonja/ext/time

     1  package time_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	arrow "github.com/bmuller/arrow/lib"
     7  
     8  	"github.com/noirbizarre/gonja"
     9  	"github.com/noirbizarre/gonja/ext/time"
    10  	tu "github.com/noirbizarre/gonja/testutils"
    11  )
    12  
    13  func Env(root string) *gonja.Environment {
    14  	env := tu.TestEnv(root)
    15  	env.Statements.Update(time.Statements)
    16  	cfg := time.NewConfig()
    17  	parsed, _ := arrow.CParse("%Y-%m-%d %H:%M:%S", "1984-06-07 16:40:00")
    18  	cfg.Now = &parsed
    19  	env.Config.Ext["time"] = cfg
    20  	return env
    21  }
    22  
    23  func TestTimeStatement(t *testing.T) {
    24  	root := "./testData"
    25  	env := Env(root)
    26  	tu.GlobTemplateTests(t, root, env)
    27  }
    28  

View as plain text