require errormsg to be specified before file.
This commit is contained in:
parent
ca394ebd95
commit
1105d03644
264 changed files with 305 additions and 623 deletions
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
line: 7
|
||||
errormsg: "has to be discarded"
|
||||
line: 7
|
||||
"""
|
||||
|
||||
proc myProc(name: string): string = "Hello " & name
|
||||
myProc("Dominik")
|
||||
myProc("Dominik")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
line: 16
|
||||
errormsg: "type mismatch"
|
||||
line: 16
|
||||
"""
|
||||
|
||||
type
|
||||
|
|
@ -13,4 +13,4 @@ type
|
|||
let dog: Dog = Dog(name: "Fluffy")
|
||||
let cat: Cat = Cat(name: "Fluffy")
|
||||
|
||||
echo(dog == cat)
|
||||
echo(dog == cat)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
line: 6
|
||||
errormsg: "type mismatch"
|
||||
line: 6
|
||||
"""
|
||||
|
||||
for i in 5:
|
||||
echo i
|
||||
echo i
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
line: 6
|
||||
errormsg: "cannot infer the type of the sequence"
|
||||
line: 6
|
||||
"""
|
||||
|
||||
var list = @[]
|
||||
var list = @[]
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
discard """
|
||||
line: 27
|
||||
errormsg: "has to be discarded"
|
||||
line: 27
|
||||
"""
|
||||
|
||||
# Page 35.
|
||||
|
||||
proc implicit: string =
|
||||
"I will be returned"
|
||||
|
||||
|
||||
proc discarded: string =
|
||||
discard "I will not be returned"
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ proc explicit: string =
|
|||
|
||||
proc resultVar: string =
|
||||
result = "I will be returned"
|
||||
|
||||
|
||||
proc resultVar2: string =
|
||||
result = ""
|
||||
result.add("I will be ")
|
||||
|
|
@ -30,4 +30,4 @@ doAssert implicit() == "I will be returned"
|
|||
doAssert discarded() == nil
|
||||
doAssert explicit() == "I will be returned"
|
||||
doAssert resultVar() == "I will be returned"
|
||||
doAssert resultVar2() == "I will be returned"
|
||||
doAssert resultVar2() == "I will be returned"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue