*: have gomtree always evaluate tar_time if it is present

if the keyword "tar_time" is present when evaluating
an Entry, gomtree should use the tar_time when evaluating
the "time" keyword as well. This commit also adds a test that
makes sure "tar_time" wins against "time" if both are present.
Some minor clean-ups as well, such as checking if KeywordFunc[keyword]
actually retrieves a function.

Signed-off-by: Stephen Chung <schung@redhat.com>
This commit is contained in:
Stephen Chung 2016-07-22 18:01:54 -04:00
parent bc6f3bf902
commit 656e577ecc
7 changed files with 106 additions and 25 deletions

View file

@ -3,7 +3,6 @@ package mtree
import (
"archive/tar"
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
@ -115,17 +114,17 @@ func TestTar(t *testing.T) {
switch {
case len(res.Failures) > 0:
for _, f := range res.Failures {
fmt.Printf("%s\n", f)
t.Errorf("%s\n", f)
}
errors += "Keyword validation errors\n"
case len(res.Missing) > 0:
for _, m := range res.Missing {
fmt.Printf("Missing file: %s\n", m.Path())
t.Errorf("Missing file: %s\n", m.Path())
}
errors += "Missing files not expected for this test\n"
case len(res.Extra) > 0:
for _, e := range res.Extra {
fmt.Printf("Extra file: %s\n", e.Path())
t.Errorf("Extra file: %s\n", e.Path())
}
errors += "Extra files not expected for this test\n"
}