mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Renmae FileStat Stat
This commit is contained in:
parent
c362634b7d
commit
d40116e5f9
3 changed files with 5 additions and 5 deletions
|
@ -55,7 +55,7 @@ func init() {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
ns.AddMethodMapping(ctx.FileStat,
|
ns.AddMethodMapping(ctx.Stat,
|
||||||
[]string{"fileStat"},
|
[]string{"fileStat"},
|
||||||
[][2]string{
|
[][2]string{
|
||||||
{`{{ (fileStat "files/README.txt").Size }}`, `11`},
|
{`{{ (fileStat "files/README.txt").Size }}`, `11`},
|
||||||
|
|
|
@ -131,8 +131,8 @@ func (ns *Namespace) FileExists(i interface{}) (bool, error) {
|
||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileStat Stat returns the os.FileInfo structure describing file.
|
// Stat returns the os.FileInfo structure describing file.
|
||||||
func (ns *Namespace) FileStat(i interface{}) (_os.FileInfo, error) {
|
func (ns *Namespace) Stat(i interface{}) (_os.FileInfo, error) {
|
||||||
path, err := cast.ToStringE(i)
|
path, err := cast.ToStringE(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -100,7 +100,7 @@ func TestFileExists(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFileStat(t *testing.T) {
|
func TestStat(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
workingDir := "/home/hugo"
|
workingDir := "/home/hugo"
|
||||||
|
@ -122,7 +122,7 @@ func TestFileStat(t *testing.T) {
|
||||||
{"", nil},
|
{"", nil},
|
||||||
} {
|
} {
|
||||||
errMsg := fmt.Sprintf("[%d] %v", i, test)
|
errMsg := fmt.Sprintf("[%d] %v", i, test)
|
||||||
result, err := ns.FileStat(test.filename)
|
result, err := ns.Stat(test.filename)
|
||||||
|
|
||||||
if test.expect == nil {
|
if test.expect == nil {
|
||||||
require.Error(t, err, errMsg)
|
require.Error(t, err, errMsg)
|
||||||
|
|
Loading…
Reference in a new issue