2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-18 15:26:16 +00:00

feat: add Nim syntax test file

This commit is contained in:
Celeo 2020-10-15 14:54:13 -07:00 committed by David Peter
parent 6872a4dd7f
commit b83716f0eb
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,41 @@
import json
const
 message = "hello world"
 multiLine = """
 foo
 bar
 """
 numbers = @[1, 2, 3]
type Options = enum
 A,
 B,
 C
## Top-level comment
type
 SomeStruct* = ref object
 value*: string
proc someFunc*(): string =
 ## Function docs
 ##
 ## More docs
 result = message
proc someOtherFunc(startingValue: int): (string, int) =
 var num = startingValue
 num += 1
 if num > 10 * 10 * 10:
 echo "Encountered an error"
 raise newException(ValueError, "Value was over 1000")
 ("Fizz", num)
proc `+=`(a: var SomeStruct, b: SomeStruct): string =
 a.value.add(b.value)
 return a.value
echo someFunc()
echo(someOtherFunc(123))
discard someFunc()

View File

@ -0,0 +1,41 @@
import json
const
message = "hello world"
multiLine = """
foo
bar
"""
numbers = @[1, 2, 3]
type Options = enum
A,
B,
C
## Top-level comment
type
SomeStruct* = ref object
value*: string
proc someFunc*(): string =
## Function docs
##
## More docs
result = message
proc someOtherFunc(startingValue: int): (string, int) =
var num = startingValue
num += 1
if num > 10 * 10 * 10:
echo "Encountered an error"
raise newException(ValueError, "Value was over 1000")
("Fizz", num)
proc `+=`(a: var SomeStruct, b: SomeStruct): string =
a.value.add(b.value)
return a.value
echo someFunc()
echo(someOtherFunc(123))
discard someFunc()