(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestInt(t *testing.T) { |
| 12 | result := Int("nonexistent", 15) |
| 13 | Parse() |
| 14 | |
| 15 | if *result != 15 { |
| 16 | t.Fatalf("expected result=15, got result=%d", *result) |
| 17 | } |
| 18 | |
| 19 | err := os.Setenv("int-key", "25") |
| 20 | if err != nil { |
| 21 | t.Fatal("unexpected error", err) |
| 22 | } |
| 23 | |
| 24 | result = Int("int-key", 15) |
| 25 | Parse() |
| 26 | |
| 27 | if *result != 25 { |
| 28 | t.Fatalf("expected result=25, got result=%d", *result) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestIntVar(t *testing.T) { |
| 33 | var result int |