Commit Graph

40 Commits

Author SHA1 Message Date
konsumlamm
d4f7f1d8f3 Improve documentation for assertions (#16988)
* Improve documentation for assertions

* Apply suggestions

Fix tests/assert/tassert_c.nim

* Use runnableExamples

* Move runnableExamples to module scope
2021-02-11 07:21:27 +01:00
flywind
9531afac48 fix #16499 (#16514) 2021-01-04 18:27:58 +01:00
Andreas Rumpf
da29222f86 init checks and 'out' parameters (#14521)
* I don't care about observable stores
* enforce explicit initializations
* cleaner code for the stdlib
* stdlib: use explicit initializations
* make tests green
* algorithm.nim: set result explicitly
* remove out parameters and bring the PR into a mergable state
* updated the changelog
2020-06-23 10:53:57 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Timothee Cour
19cab9fa51 stacktraces can now show custom runtime msgs per frame (#13351)
* stacktraces can now show custom runtime msgs
* improve tests/stdlib/tstackframes.nim
* fix test for --gc:arc
* test --stacktraceMsgs:on and --stacktraceMsgs:off
* --stacktracemsgs:off by default
2020-03-30 13:45:32 +02:00
Miran
8088633250 faster CIs (#13803)
* ttables: smaller table, 5x speedup

* thavlak: less iterations, less loops; 30% speedup

* tasyncclosestall: shorter timeout; 35% speedup

* gcleak4: less iterations, 2x speedup

* ttimes: remove deprecated stuff

* tdangerisrelease: remove cpp backend, 3x speedup

* tfrexp1: smaller range, 2x speedup

* trtree: fix warnings, less iterations, 6x speedup

* tasyncawait_cyclebreaker: smaller swarm size; 2x speedup

* trealloc: smaller number of iterations; 10x speedup

* towned_binary_tree: less iterations, 4x speedup

* tclosure: remove unused code, less iterations; 2x speedup

* twaitany: less durations; 1.4x speedup

* tasync_misc: less iterations, 2x speedup

* t8535: smaller sleep, 1.5x speedup

* tmanyjoin: smaller sleep, 2x speedup

* t12221: shorter sleeps, removed two slower tests; 1.6x speedup

* tfuturestream: smaller sleep; 1.5x speedup

* growobjcrash: less iterations; 2x speedup

* ttryrecv: smaller sleep; 1.5x speedup

* treusetvar: less threads; 2x speedup

* delete tthreadanalysis2, basically a duplicate of tthreadanalysis

* t7758: less iterations, 1.5x speedup

* tasyncawait: smaller swarm, less messages; 1.5x speedup

* tjsandnativeasync: smaller sleep, 1.5x speedup

* tpendingcheck: smaller sleep, 1.5x speedup

* remove rodfiles test category

* move tseq from its own category to 'collections' category

* remove unneeded tests and helpers from 'assert' category

* stdlib: merge tbitops2 into tbitops

* remove 'trepr2' from 'stdlib' cat

* merge 'tstreams' into one file

* remove 'tinefficient_const_table' from 'ccbugs' cat

* merge 'tcollections_to_string' into 'tcollections'

* tblocking_channel: smaller sleep, small speedup

* tconvexhull: less iterartions; 1.2x speedup

* merge 'tdeepcopy2' into 'tdeepcopy'

* merge 'tdisjoint_slice2' into 'tdisjoint_slice1'

* tmissing_deepcopy: smaller sequence

* tsendtwice: smaller arrays; 5x speedup

* remove 'tindexerrorformatbounds'

* disable multimethod tests

* remove 'gc:none' and 'refc' without 'd:useRealtimeGC' from gc tests

* koch.nim: bootstrap just with '-d:release', no need for 'csource'

* add github workflow for documentation

* testament: no need for 8 sub-second decimals
2020-03-30 13:18:12 +02:00
Andreas Rumpf
a6682de004 catchable defects (#13626)
* allow defects to be caught even for --exceptions:goto (WIP)
* implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180
* new implementation for integer overflow checking
* produce a warning if a user-defined exception type inherits from Exception directly
* applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic'
* fixes #13627
* don't inherit from Exception directly
2020-03-12 23:44:33 +01:00
Andreas Rumpf
a0eca75182 sink parameter inference for types that have destructors (#13544)
* ensure capitalize doesn't take an inferred sink parameter

* sink parameter inference: first version, for now disabled. Changed that sink parameters can be consumed multiple times in order to adhere to our spec.

* sink inference can now be disabled with .nosinks; sometimes for proc type interop this is required

* fixes yet another critical DFA bug

* better implementation that also understands if expressions etc

* document sink parameter inference and allow for global disabling
2020-03-04 14:28:53 +01:00
Andreas Rumpf
c3344862b0 --exception:goto switch for deterministic exception handling (#12977)
This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
2020-01-01 10:01:49 +01:00
Brian Wignall
a7aeabb9d2 [backport] Fix spelling typos (#12755) 2019-11-28 08:30:55 +01:00
Araq
80b508d337 test suite: rename tests containing 'fail' for easier search in logs 2019-11-26 16:04:28 +01:00
Federico Ceratto
39290cf88c Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
alaviss
2c10b246ec assertions: fixes #11545 (#11605)
* assertions: properly fix #11545

* tests/assert: enable excessiveStackTrace

* tests/assert: add test case for #11545

* tfailedassert_stacktrace: disable excessiveStackTrace

* assertions: weird workaround for failing tests

This fixes megatest on *nix, but have no idea why
2019-07-01 13:19:07 +02:00
Miran
84d3f3d448 move system.dollars in a separate file (#10829) 2019-03-13 15:59:09 +01:00
Miran
2b5e48d807 move assertions and iterators out of system.nim (#10597)
* move assertions and iterators out of system.nim
* limit nimsuggest tests to the first 3 suggestions
2019-03-07 00:49:39 +01:00
Arne Döring
1105d03644 require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
Randy Smith
6c7abe6e5b Fixes #9671 (#9750) 2018-11-19 09:22:21 +01:00
Timothee Cour
3e2d8c1c53 correctly render AST in doAssert/assert condition: fixes #8518; refs #9301 (#9332)
* fixes #8518; refs #9301; correctly render AST in doAssert condition
2018-10-14 00:17:10 +02:00
Araq
e4902a4a35 make tfailedassert_stacktrace.nim more robust 2018-09-15 10:06:02 +02:00
Ganesh Viswanathan
f4356d6115 Fix system.nim line number test case failure 2018-09-12 12:58:50 -05:00
Timothee Cour
72170b443d add testcase 2018-09-11 11:52:51 -07:00
Timothee Cour
3a626179ee doAssert, assert now print full path of failing line on error (#8555) 2018-08-25 21:48:37 +02:00
awr1
bf973d29da Fixes #8719 (onFailedAssert now works for doAssert) (#8731) 2018-08-23 10:20:58 +02:00
Andreas Rumpf
0926754e68 make tests green again 2018-07-05 15:51:04 +02:00
PMunch
4f1725ad61 Add column number to instantiation info (#7376)
* Add column number to instantiation info

Instantiation info left out column number for no good reason. This adds
it in as the third element of the tuple.

* Fix test that failed and added change to changelog

An assertion test failed because it was declaring a type that was
expected to be populated by instantiationInfo with the old signature.

Also added the changes to the changelog as it is a breaking change.
2018-04-12 20:02:04 +02:00
Arne Döring
000b8afd26 Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
Andreas Rumpf
bc9015df50 make tests green again 2016-11-24 11:48:23 +01:00
Yuriy Glukhov
e61cfea78b Fixed broken test. Added closureScope test. 2016-06-28 13:15:02 +03:00
Adam Strzelecki
e80465dacf tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:04:32 +02:00
Araq
3a9500f7b1 fixes #2500 2015-04-10 14:03:47 +02:00
def
69e2b61c0a Fix tests a bit more 2015-03-10 15:34:15 +01:00
Araq
24ae0c387f some love for the testsuite; fixed regressions 2015-03-01 21:41:21 +01:00
def
4fbf47ca5e Clean up tests/assert
1 test still fails:

- tunittests uses utemplates, which seems broken. not sure what it's
  supposed to do
2015-02-04 20:30:09 +01:00
Simon Hafner
9c12ad0187 typo fix 2015-01-27 13:02:05 -06:00
Araq
6713ebcd98 tester compiles again 2014-08-29 01:12:18 +02:00
Araq
4ab56d6be0 some minor fixes 2014-08-14 22:22:04 +02:00
Dominik Picheta
152fcc8ec4 Change the expected path in tfailedassert.
This will cause this test to fail on Linux. The behaviour on Windows is
however correct, the filename returned by instantiationInfo is the
projPath defined as being "relative to the project's root".
2014-04-06 23:57:20 +01:00
Zahary Karadjov
3c840102bc fix the error "only proc headers can feature pragmas" when compiling in JS mode 2014-01-23 00:02:57 +02:00
Araq
5073914b86 unittest module works again 2014-01-18 00:58:59 +01:00
Araq
20b5f31c03 new tester; all tests categorized 2014-01-13 02:10:03 +01:00