diff options
Diffstat (limited to 'nimpretty/tests')
-rw-r--r-- | nimpretty/tests/exhaustive.nim | 22 | ||||
-rw-r--r-- | nimpretty/tests/expected/exhaustive.nim | 23 | ||||
-rw-r--r-- | nimpretty/tests/expected/simple.nim | 16 | ||||
-rw-r--r-- | nimpretty/tests/simple.nim | 16 |
4 files changed, 59 insertions, 18 deletions
diff --git a/nimpretty/tests/exhaustive.nim b/nimpretty/tests/exhaustive.nim index 2ba885d9a..e5a73305b 100644 --- a/nimpretty/tests/exhaustive.nim +++ b/nimpretty/tests/exhaustive.nim @@ -267,7 +267,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) = if not em.endsInWhite: wr(" ") wr(tok.ident.s) template isUnary(tok): bool = - tok.strongSpaceB == 0 and tok.strongSpaceA > 0 + tok.spacing == {tsLeading} if not isUnary(tok) or em.lastTok in {tkOpr, tkDotDot}: wr(" ") @@ -418,9 +418,9 @@ proc isValid1*[A](s: HashSet[A]): bool {.deprecated: result = s.data.len > 0 # bug #11468 -assert $type(a) == "Option[system.int]" -foo(a, $type(b), c) -foo(type(b), c) # this is ok +assert $typeof(a) == "Option[system.int]" +foo(a, $typeof(b), c) +foo(typeof(b), c) # this is ok proc `<`*[A](s, t: A): bool = discard proc `==`*[A](s, t: HashSet[A]): bool = discard @@ -693,11 +693,11 @@ proc newRecordGen(ctx: Context; typ: TypRef): PNode = String `interpolation`:idx: / `format`:idx: inspired by Python's ``f``-strings. -.. code-block:: nim - - import strformat - let msg = "hello" - doAssert fmt"{msg}\n" == "hello\\n" + ```nim + import strformat + let msg = "hello" + doAssert fmt"{msg}\n" == "hello\\n" + ``` Because the literal is a raw string literal, the ``\n`` is not interpreted as an escape sequence. @@ -843,3 +843,7 @@ type SpinnyEvent2 = tuple kind: EventKind payload: string + + +proc hid_open*(vendor_id: cushort; product_id: cushort; serial_number: cstring): ptr HidDevice {. + importc: "hid_open", dynlib: hidapi.} diff --git a/nimpretty/tests/expected/exhaustive.nim b/nimpretty/tests/expected/exhaustive.nim index cfe9a43fa..7f78b7e56 100644 --- a/nimpretty/tests/expected/exhaustive.nim +++ b/nimpretty/tests/expected/exhaustive.nim @@ -272,7 +272,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) = if not em.endsInWhite: wr(" ") wr(tok.ident.s) template isUnary(tok): bool = - tok.strongSpaceB == 0 and tok.strongSpaceA > 0 + tok.spacing == {tsLeading} if not isUnary(tok) or em.lastTok in {tkOpr, tkDotDot}: wr(" ") @@ -423,9 +423,9 @@ proc isValid1*[A](s: HashSet[A]): bool {.deprecated: result = s.data.len > 0 # bug #11468 -assert $type(a) == "Option[system.int]" -foo(a, $type(b), c) -foo(type(b), c) # this is ok +assert $typeof(a) == "Option[system.int]" +foo(a, $typeof(b), c) +foo(typeof(b), c) # this is ok proc `<`*[A](s, t: A): bool = discard proc `==`*[A](s, t: HashSet[A]): bool = discard @@ -699,11 +699,11 @@ proc newRecordGen(ctx: Context; typ: TypRef): PNode = String `interpolation`:idx: / `format`:idx: inspired by Python's ``f``-strings. -.. code-block:: nim - - import strformat - let msg = "hello" - doAssert fmt"{msg}\n" == "hello\\n" + ```nim + import strformat + let msg = "hello" + doAssert fmt"{msg}\n" == "hello\\n" + ``` Because the literal is a raw string literal, the ``\n`` is not interpreted as an escape sequence. @@ -856,3 +856,8 @@ type SpinnyEvent2 = tuple kind: EventKind payload: string + + +proc hid_open*(vendor_id: cushort; product_id: cushort; + serial_number: cstring): ptr HidDevice {. + importc: "hid_open", dynlib: hidapi.} diff --git a/nimpretty/tests/expected/simple.nim b/nimpretty/tests/expected/simple.nim index 5126658ea..e711eb3b6 100644 --- a/nimpretty/tests/expected/simple.nim +++ b/nimpretty/tests/expected/simple.nim @@ -11,3 +11,19 @@ proc a() = # comment 2 discard + +# bug #15596 +discard ## comment 3 + +discard # comment 4 + + +# bug #20553 + +let `'hello` = 12 +echo `'hello` + + +proc `'u4`(n: string) = + # The leading ' is required. + discard diff --git a/nimpretty/tests/simple.nim b/nimpretty/tests/simple.nim index 5126658ea..2a01a176e 100644 --- a/nimpretty/tests/simple.nim +++ b/nimpretty/tests/simple.nim @@ -11,3 +11,19 @@ proc a() = # comment 2 discard + +# bug #15596 +discard## comment 3 + +discard # comment 4 + + +# bug #20553 + +let `'hello` = 12 +echo `'hello` + + +proc `'u4`(n: string) = + # The leading ' is required. + discard |