|
|
@@ -7,6 +7,7 @@
|
|
|
package unix_test
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"testing"
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
@@ -31,3 +32,19 @@ func TestEnv(t *testing.T) {
|
|
|
// make sure TESTENV gets set to "", not deleted
|
|
|
testSetGetenv(t, "TESTENV", "")
|
|
|
}
|
|
|
+
|
|
|
+func TestItoa(t *testing.T) {
|
|
|
+ // Make most negative integer: 0x8000...
|
|
|
+ i := 1
|
|
|
+ for i<<1 != 0 {
|
|
|
+ i <<= 1
|
|
|
+ }
|
|
|
+ if i >= 0 {
|
|
|
+ t.Fatal("bad math")
|
|
|
+ }
|
|
|
+ s := unix.Itoa(i)
|
|
|
+ f := fmt.Sprint(i)
|
|
|
+ if s != f {
|
|
|
+ t.Fatalf("itoa(%d) = %s, want %s", i, s, f)
|
|
|
+ }
|
|
|
+}
|