Skip to content

Commit fa2d0e2

Browse files
committed
add some test case
1 parent 05546b4 commit fa2d0e2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

if_expression_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ func ExampleReturn() {
1717
// 是
1818
}
1919

20-
func TestMap(t *testing.T) {
21-
m := map[string]interface{}{
22-
"foo": "bar",
23-
}
24-
//t.Log(m["bad"]) // nil
25-
t.Log(Return(m["bad"] != nil, m["bad"], "aaa")) // ⚠️ 范型传nil进来就panic了.
26-
}
20+
//func TestMap(t *testing.T) {
21+
// m := map[string]interface{}{
22+
// "foo": "bar",
23+
// }
24+
// m["bar"] = "aaa"
25+
// //t.Log(m["bad"]) // nil
26+
// var v string
27+
// v = Return[string](m["bad"] == nil, m["bar"], "aaa") // m["bar"]的类型不对
28+
// t.Log(v)
29+
//}

0 commit comments

Comments
 (0)