diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/concepts/texplain.nim | 84 | ||||
-rw-r--r-- | tests/testament/tester.nim | 6 |
2 files changed, 59 insertions, 31 deletions
diff --git a/tests/concepts/texplain.nim b/tests/concepts/texplain.nim index 9b2b1f70d..186621f5b 100644 --- a/tests/concepts/texplain.nim +++ b/tests/concepts/texplain.nim @@ -1,36 +1,63 @@ discard """ cmd: "nim c --verbosity:0 --colors:off $file" nimout: ''' -tests/concepts/texplain.nim(71, 10) Hint: Non-matching candidates for e(y) +tests/concepts/texplain.nim(99, 10) Hint: Non-matching candidates for e(y) proc e(i: int): int - [User] -tests/concepts/texplain.nim(74, 7) Hint: Non-matching candidates for e(10) -proc e[ExplainedConcept](o: ExplainedConcept): int -tests/concepts/texplain.nim(38, 6) Error: undeclared field: 'foo' -tests/concepts/texplain.nim(38, 6) Error: undeclared field: '.' -tests/concepts/texplain.nim(38, 6) Error: type mismatch: got ( - [User] -tests/concepts/texplain.nim(77, 10) Hint: Non-matching candidates for e(10) -proc e[ExplainedConcept](o: ExplainedConcept): int -tests/concepts/texplain.nim(38, 6) Error: undeclared field: 'foo' -tests/concepts/texplain.nim(38, 6) Error: undeclared field: '.' -tests/concepts/texplain.nim(38, 6) Error: type mismatch: got ( - [User] -tests/concepts/texplain.nim(81, 20) Error: type mismatch: got ( -tests/concepts/texplain.nim(82, 20) Error: type mismatch: got ( -tests/concepts/texplain.nim(83, 20) Hint: Non-matching candidates for r(y) + +tests/concepts/texplain.nim(102, 7) Hint: Non-matching candidates for e(10) +proc e(o: ExplainedConcept): int +tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo' +tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.' +tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called +tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed +tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar' +tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.' +tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called +tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed + +tests/concepts/texplain.nim(105, 10) Hint: Non-matching candidates for e(10) +proc e(o: ExplainedConcept): int +tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: 'foo' +tests/concepts/texplain.nim(65, 6) ExplainedConcept: undeclared field: '.' +tests/concepts/texplain.nim(65, 6) ExplainedConcept: expression '.' cannot be called +tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed +tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: 'bar' +tests/concepts/texplain.nim(66, 6) ExplainedConcept: undeclared field: '.' +tests/concepts/texplain.nim(66, 6) ExplainedConcept: expression '.' cannot be called +tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed + +tests/concepts/texplain.nim(109, 20) Error: type mismatch: got (NonMatchingType) +but expected one of: +proc e(o: ExplainedConcept): int +tests/concepts/texplain.nim(65, 5) ExplainedConcept: type class predicate failed +proc e(i: int): int + +tests/concepts/texplain.nim(110, 20) Error: type mismatch: got (NonMatchingType) +but expected one of: +proc r(o: RegularConcept): int +tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed +proc r[T](a: SomeNumber; b: T; c: auto) proc r(i: string): int - [User] -tests/concepts/texplain.nim(91, 2) Error: type mismatch: got (MatchingType) + +tests/concepts/texplain.nim(111, 20) Hint: Non-matching candidates for r(y) +proc r[T](a: SomeNumber; b: T; c: auto) +proc r(i: string): int + +tests/concepts/texplain.nim(119, 2) Error: type mismatch: got (MatchingType) but expected one of: -proc f[NestedConcept](o: NestedConcept) -tests/concepts/texplain.nim(42, 6) Error: undeclared field: 'foo' -tests/concepts/texplain.nim(42, 6) Error: undeclared field: '.' -tests/concepts/texplain.nim(42, 6) Error: type mismatch: got ( -tests/concepts/texplain.nim(46, 5) Error: type class predicate failed +proc f(o: NestedConcept) +tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: 'foo' +tests/concepts/texplain.nim(69, 6) RegularConcept: undeclared field: '.' +tests/concepts/texplain.nim(69, 6) RegularConcept: expression '.' cannot be called +tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed +tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: 'bar' +tests/concepts/texplain.nim(70, 6) RegularConcept: undeclared field: '.' +tests/concepts/texplain.nim(70, 6) RegularConcept: expression '.' cannot be called +tests/concepts/texplain.nim(69, 5) RegularConcept: type class predicate failed +tests/concepts/texplain.nim(73, 5) NestedConcept: type class predicate failed ''' - line: 46 - errormsg: "type class predicate failed" + line: 119 + errormsg: "type mismatch: got (MatchingType)" """ type @@ -56,6 +83,7 @@ type proc e(o: ExplainedConcept): int = 1 proc e(i: int): int = i +proc r[T](a: SomeNumber, b: T, c: auto) = discard proc r(o: RegularConcept): int = 1 proc r(i: string): int = 1 @@ -77,11 +105,11 @@ echo(e(10) {.explain.}, 20) discard e(10) static: - # provide diagnostics why the compile block failed + # provide diagnostics why the compile block failed assert(compiles(e(n)) {.explain.} == false) assert(compiles(r(n)) {.explain.} == false) assert(compiles(r(y)) {.explain.} == true) - + # these should not produce any output assert(compiles(r(10)) == false) assert(compiles(e(10)) == true) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 908eba962..2d758ef0d 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -63,6 +63,8 @@ let var targets = {low(TTarget)..high(TTarget)} +proc normalizeMsg(s: string): string = s.strip.replace("\C\L", "\L") + proc callCompiler(cmdTemplate, filename, options: string, target: TTarget): TSpec = let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target], @@ -184,7 +186,7 @@ proc addResult(r: var TResults, test: TTest, proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = if strip(expected.msg) notin strip(given.msg): r.addResult(test, expected.msg, given.msg, reMsgsDiffer) - elif expected.nimout.len > 0 and expected.nimout.normalize notin given.nimout.normalize: + elif expected.nimout.len > 0 and expected.nimout.normalizeMsg notin given.nimout.normalizeMsg: r.addResult(test, expected.nimout, given.nimout, reMsgsDiffer) elif expected.tfile == "" and extractFilename(expected.file) != extractFilename(given.file) and "internal error:" notin expected.msg: @@ -235,8 +237,6 @@ proc nimoutCheck(test: TTest; expectedNimout: string; given: var TSpec) = if exp notin giv: given.err = reMsgsDiffer -proc normalize(s: string): string = s.strip.replace("\C\L", "\L") - proc makeDeterministic(s: string): string = var x = splitLines(s) sort(x, system.cmp) |