Skip to content

Commit

Permalink
Nim regression test for canBeImplicit
Browse files Browse the repository at this point in the history
  • Loading branch information
flyx committed Dec 21, 2023
1 parent c7e5a8a commit 97e8f58
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
- windows-latest
- macOS-latest
nim-version:
- '2.0.x'
- stable
- devel
- '2.0.0'
- '2.0.2'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -47,11 +46,4 @@ jobs:

- name: Test
run: |
nim lexerTests
nim parserTests
nim jsonTests
nim domTests
nim nativeTests
nim quickstartTests
nim hintsTests
nim presenterTests
nim test
2 changes: 1 addition & 1 deletion config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task build, "Compile the YAML module into a library":
task test, "Run all tests":
--r
--verbosity:0
setCommand "c", "test/tests"
setCommand "c", "test/tnimregress"

task lexerTests, "Run lexer tests":
--r
Expand Down
17 changes: 17 additions & 0 deletions test/tnimregress.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest, macros

type
Container = object
foo: string

proc canBeImplicit(t: typedesc): string {.compileTime.} =
## returns empty string if type can be implicit, else the reason why it can't
let tDesc = getType(t)
if tDesc.kind != nnkObjectTy: return "type is not an object, but a " & $tDesc.kind
return ""

suite "Nim Regression Tests":
test "canBeImplicit":
const res = canBeImplicit(Container)
assert len(res) == 0, "unexpected error for canBeImplicit: " & res

0 comments on commit 97e8f58

Please sign in to comment.