diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-04 23:39:08 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-04 23:39:08 +0800 |
commit | e22e8b7feffedced7fa1f8809b1828a224ccf774 (patch) | |
tree | 4bc94418b98c4bcdb475b4fe7cc2404671d168e1 /ethutil/common_test.go | |
parent | f59a3b67f69b26f969084e0de165435e80bd8e12 (diff) | |
download | dexon-e22e8b7feffedced7fa1f8809b1828a224ccf774.tar.gz dexon-e22e8b7feffedced7fa1f8809b1828a224ccf774.tar.zst dexon-e22e8b7feffedced7fa1f8809b1828a224ccf774.zip |
Environment tests
Diffstat (limited to 'ethutil/common_test.go')
-rw-r--r-- | ethutil/common_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ethutil/common_test.go b/ethutil/common_test.go index 2667eaf3a..e6e2d1e8b 100644 --- a/ethutil/common_test.go +++ b/ethutil/common_test.go @@ -2,9 +2,36 @@ package ethutil import ( "math/big" + "os" "testing" ) +func TestOS(t *testing.T) { + res := IsWindows() + + if res && (os.PathSeparator != '\\' || os.PathListSeparator != ';') { + t.Error("IsWindows is", res, "but path is", os.PathSeparator) + } + + if !res && (os.PathSeparator == '\\' && os.PathListSeparator == ';') { + t.Error("IsWindows is", res, "but path is", os.PathSeparator) + } +} + +func TestWindonziePath(t *testing.T) { + path := "/opt/eth/test/file.ext" + res := WindonizePath(path) + iswindowspath := os.PathSeparator == '\\' + + if !iswindowspath && string(res[0]) != "/" { + t.Error("Got", res) + } + + if iswindowspath && string(res[0]) == "/" { + t.Error("Got", res) + } +} + func TestCommon(t *testing.T) { ether := CurrencyToString(BigPow(10, 19)) finney := CurrencyToString(BigPow(10, 16)) |