diff options
Diffstat (limited to 'nimpretty/tests')
-rw-r--r-- | nimpretty/tests/exhaustive.nim | 12 | ||||
-rw-r--r-- | nimpretty/tests/expected/exhaustive.nim | 12 | ||||
-rw-r--r-- | nimpretty/tests/expected/simple.nim | 11 | ||||
-rw-r--r-- | nimpretty/tests/simple.nim | 11 |
4 files changed, 34 insertions, 12 deletions
diff --git a/nimpretty/tests/exhaustive.nim b/nimpretty/tests/exhaustive.nim index 30cfc47a9..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(" ") @@ -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. diff --git a/nimpretty/tests/expected/exhaustive.nim b/nimpretty/tests/expected/exhaustive.nim index 82927a11c..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(" ") @@ -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. diff --git a/nimpretty/tests/expected/simple.nim b/nimpretty/tests/expected/simple.nim index d13558621..e711eb3b6 100644 --- a/nimpretty/tests/expected/simple.nim +++ b/nimpretty/tests/expected/simple.nim @@ -16,3 +16,14 @@ proc a() = 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 435bd6bd2..2a01a176e 100644 --- a/nimpretty/tests/simple.nim +++ b/nimpretty/tests/simple.nim @@ -16,3 +16,14 @@ proc a() = discard## comment 3 discard # comment 4 + + +# bug #20553 + +let `'hello` = 12 +echo `'hello` + + +proc `'u4`(n: string) = + # The leading ' is required. + discard |