Fix fail proc

This commit is contained in:
2020-07-01 22:33:34 +02:00
parent f832858583
commit 7884ca4a8f
2 changed files with 4 additions and 4 deletions

View File

@@ -13,5 +13,5 @@ proc ok*[T](val: T): OI[T] =
proc fail*(oi: OI, msg: string): OI =
OI(isOK: false, error: msg)
proc fail*(msg: string): OI[auto] =
OI[auto](isOK: false, error: msg)
proc fail*[T](msg: string): OI[T] =
OI[T](isOK: false, error: msg)

View File

@@ -8,7 +8,7 @@ test "Check OK":
check test.isOk == true
test "Check fail":
let test = fail "no data here"
let test = oi.fail[int] "no data here"
check test.isOk == false
test "Check proc results":
@@ -31,7 +31,7 @@ test "Check changing result":
proc checker(): OI[int] =
result = ok 42
# something happend here
result = fail "data got corrupted"
result = result.fail "data got corrupted"
let data = checker()
check data.isOk == false