Renmae FileStat Stat
authorsatotake <doublequotation@gmail.com>
Sun, 5 Aug 2018 12:59:29 +0000 (21:59 +0900)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 6 Aug 2018 07:54:26 +0000 (09:54 +0200)
tpl/os/init.go
tpl/os/os.go
tpl/os/os_test.go

index b11e742eb55145ba36ce7f4925d06c91fb42fe59..0b52ddea205d9a070c0b5049ee908ae4664749cf 100644 (file)
@@ -55,7 +55,7 @@ func init() {
                        },
                )
 
-               ns.AddMethodMapping(ctx.FileStat,
+               ns.AddMethodMapping(ctx.Stat,
                        []string{"fileStat"},
                        [][2]string{
                                {`{{ (fileStat "files/README.txt").Size }}`, `11`},
index 04f151ec91a25fa6cead9350af4ddd877a27693e..aca80ae9dac29e3255b10dce18c44f10f0be288d 100644 (file)
@@ -131,8 +131,8 @@ func (ns *Namespace) FileExists(i interface{}) (bool, error) {
        return status, nil
 }
 
-// FileStat Stat returns the os.FileInfo structure describing file.
-func (ns *Namespace) FileStat(i interface{}) (_os.FileInfo, error) {
+// Stat returns the os.FileInfo structure describing file.
+func (ns *Namespace) Stat(i interface{}) (_os.FileInfo, error) {
        path, err := cast.ToStringE(i)
        if err != nil {
                return nil, err
index 60e6b1f63fe98379d11b3210ca0e6a51db59cc95..46dafd842152897e34b2d74d24752acd2ccbc9da 100644 (file)
@@ -100,7 +100,7 @@ func TestFileExists(t *testing.T) {
        }
 }
 
-func TestFileStat(t *testing.T) {
+func TestStat(t *testing.T) {
        t.Parallel()
 
        workingDir := "/home/hugo"
@@ -122,7 +122,7 @@ func TestFileStat(t *testing.T) {
                {"", nil},
        } {
                errMsg := fmt.Sprintf("[%d] %v", i, test)
-               result, err := ns.FileStat(test.filename)
+               result, err := ns.Stat(test.filename)
 
                if test.expect == nil {
                        require.Error(t, err, errMsg)