summaryrefslogtreecommitdiff
path: root/strutil
diff options
authorMichael Vogt <mvo@ubuntu.com>2018-08-27 08:21:08 +0200
committerMichael Vogt <mvo@ubuntu.com>2018-08-27 08:40:46 +0200
commiteadf56fa7c23333d7d77fbafa912469ca92f520e (patch)
treeb8c8389cc594ce39c58c2fe8b262635009f43986 /strutil
parent9ef590f17859a5807111c44f419c6bb6c74ff71d (diff)
address review feedback
Diffstat (limited to 'strutil')
-rw-r--r--strutil/strutil.go2
-rw-r--r--strutil/strutil_test.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/strutil/strutil.go b/strutil/strutil.go
index 450d576aa5..274d3353aa 100644
--- a/strutil/strutil.go
+++ b/strutil/strutil.go
@@ -113,7 +113,7 @@ func TruncateOutput(data []byte, maxLines, maxBytes int) []byte {
}
// ParseValueWithUnit parses a value like 500kB and returns the number
-// in byte. The case of the unit will be ignored for user convenience.
+// in bytes. The case of the unit will be ignored for user convenience.
func ParseValueWithUnit(inp string) (int64, error) {
unitMultiplier := map[string]int64{
"B": 1,
diff --git a/strutil/strutil_test.go b/strutil/strutil_test.go
index 8dbe6629e2..d6af547186 100644
--- a/strutil/strutil_test.go
+++ b/strutil/strutil_test.go
@@ -154,6 +154,9 @@ func (ts *strutilSuite) TestParseValueWithUnitHappy(c *check.C) {
{"20MB", 20 * 1000 * 1000},
{"1GB", 1000 * 1000 * 1000},
{"31GB", 31 * 1000 * 1000 * 1000},
+ {"4TB", int64(4 * 1000 * 1000 * 1000 * 1000)},
+ {"6PB", int64(6 * 1000 * 1000 * 1000 * 1000 * 1000)},
+ {"8EB", int64(8 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)},
} {
val, err := strutil.ParseValueWithUnit(t.str)
c.Check(err, check.IsNil)