panic!
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package go_koans
|
||||
|
||||
func aboutPanics() {
|
||||
panic("crap")
|
||||
func divideFourBy(i int) int {
|
||||
return 4 / i
|
||||
}
|
||||
|
||||
func aboutPanics() {
|
||||
n := divideFourBy(0)
|
||||
assert(n == 2) // panics are exceptional errors at runtime
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestKoans(t *testing.T) {
|
||||
aboutStructs()
|
||||
aboutAllocation()
|
||||
aboutConcurrency()
|
||||
//aboutPanics()
|
||||
aboutPanics()
|
||||
|
||||
fmt.Printf("\n%c[32;1mYou won life. Good job.\n\n", 27)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user