summary refs log tree commit diff stats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* fixes #21461 (#21463)Arnaud Moura2023-03-031-1/+1
| | | | | * fixes #21461; Move nim-gdb.py and add nim-lldb.py * fixes bad path for nim-gdb.py
* Allow `futureLogging` in release builds (#21448)Jake Leahy2023-03-021-0/+6
| | | | | | | * Add test case * Fixes 21447: Keeps stackTrace around when using futureLogging * Remove extra whitespace
* fixes #20139; hash types based on its path relative to its package path ↵ringabout2023-03-023-0/+18
| | | | | | | | | | | | | | | (#21274) [backport:1.6] * fixes #20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep th… ↵Andreas Rumpf2023-03-021-0/+12
| | | | | (#21459) fixes #20422; emit nimPrepareStrMutationV2 for toOpenArray to keep the abstraction of mutable strings which have immutable string literals
* fixes #19291; implements `wasMoved` hook (#21303)ringabout2023-03-025-23/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fixes #19291; implements `wasMoved` hook * basics * checkpoint * finish `wasMoved` * add a test for #19291 * add documentation and changelog * work `attachedWasMoved` with generics * fixes optimizer * register `=wasMoved` * handle wasMoved magcis * check another round * some patches * try `op == nil` * nicer * generate `wasMoved` before `destroy` * try again * fixes tests * default wasMoved * Update tests/destructor/tv2_cast.nim * Update tests/destructor/tv2_cast.nim * Update tests/arc/topt_refcursors.nim
* fixes #21326; fixes #7375; fixes #11986; fixes #9607; rework quote do; ↵ringabout2023-03-021-0/+136
| | | | | | | | | | | | | `getAst` uses type info to annotate the type of quoted variables; no more type erasures for quoted variables (#21433) * fixes #21326; getAst uses type info to annotateType quoted variables * simplify logics; sem types first * fixes important packages * add testcases * tiny
* tests/errmsgs/tcall_with_default_arg.nim: sync (#21237)Anna2023-03-011-1/+1
|
* tests: explicitly enable stack traces where needed (#21236)Anna2023-03-014-18/+21
| | | | | * tests/assert/tassert_c.nim: explicitly enable stack traces * tests/errmsgs: explicitly enable stack traces
* tests/stylecheck: make sure necessary hints are enabled (#21240)Anna2023-03-013-8/+6
|
* fixes #10938; fixes #13312; fixes #13918; fixes #20985; always initializes ↵ringabout2023-03-011-2/+44
| | | | | | | | | | | global variables with null values in VM (#21351) * fixes #10938; always initialize global variable in VM * fixes importc vars * there is a pre-existing issue regarding closure types in the VM * add tests
* fixes #21439; Add tyOpenArray to genTypeInfo. (#21440)Constantine Molchanov2023-02-271-0/+14
| | | | | * fixes #21439; Add tyOpenArray to genTypeInfo. * Add test.
* closes #17864; add a test case (#21434)ringabout2023-02-251-0/+12
|
* fixes #20695; fixes object with distinct defaults and tables (#21428)ringabout2023-02-241-1/+38
|
* fixes #21393 and misc style changes (#21419)Andreas Rumpf2023-02-241-1/+1
| | | | | | | | | * fixes #21393 and misc style changes * progress --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* fixes #19795; fixes #11852; fixes #19974; remove parsing pipeline, Nim now ↵ringabout2023-02-2221-59/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parses the whole module at one time (#21379) * fixes #19795; remove parse pipeline * isScript * fixes nimscriptapi * don't touch reorder * check script * fixes tests * it seems implicit imports of system cause troubles * access the first child of `nkStmtList` * ignore comments * minor messages * perhaps increases hloLoopDetector * the module is a stmtList, which changes the errors * fixes nimdoc * fixes tlinter * fixes nim secret tests * fixes arc_misc * fixes nim secret tests again * safe; fixes one more test * GlobalError is the root cause too * fixes parsing errors * put emit types to the cfsForwardTypes section * fixes #11852; `{.push checks:off}` now works in procs * disable navigator * fixes nimdoc * add tests for JS * fixes nimsuggest
* Specify that address is taken when converter takes a var parameter (#21391)Jake Leahy2023-02-211-0/+15
| | | | | | | * Add test case * closes #21247 Add the sfAddrTaken flag to var parameters in converters This allows the JS backend to properly pass the parameter as a fat pointer
* Make `Time` work with `std/strformat` (#21409)Jake Leahy2023-02-211-0/+5
| | | | | | | * Add test case * Remove formatValue template for `Time` It didn't handle empty specifier correctly which caused it to be blank with strformat
* Support tuples in nim-gdb (#21410)Jake Leahy2023-02-212-2/+6
| | | | | | | | | * Support for printing tuple types * Add test of printing a tuple * Add support for printing tuples in GDB * Forgot to [skip ci]
* Support new runtime with nim-gdb (#21400)Jake Leahy2023-02-204-51/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for orc strings * Cleaned up testing script Enums now printing properly Merged both old and new strings into the one printer Moving onto sets which seem kinda difficult * Sets working Instead of trying to imitate how Nim represents enums, I just call the dollar proc for each enum value While this runs into problems if the user doesn't call the dollar proc anywhere, I believe its a decent tradeoff I've cleaned up the error message for when it cannot find dollar proc (Might add in proper message on how to fix) * Support sequences V2 runtime seems to have sequences that don't have a len (Guessing its some kind of short seq optimisation?) but I've rolled the implementation into normal sequences since the implementation is practically the same * Clean up test program so it isn't using diff Also don't redirect the first nim compile to /dev/null so that we can check for any compilation errors I found the diff to be annoying to read (Seeing as the test script already performs diffing) * Tables are now supported * Add colours to test output It was getting difficult to tell apart test output from GDB output so I added colour to better tell them apart * Both old and new runtime are working Set exit code in python test script so that this could possibly be added to the CI. Only issue is that it can be flaky (GDB crashes randomly for some reason) * Remove old code that was commented out If I need it later I'll just use git * Remove branch that never runs * Remove the old test output [skip ci]
* closes #1072; add a test case (#21396)ringabout2023-02-191-0/+10
|
* fixes #21360; discarding empty seqs/arrays now raises errors (#21374)ringabout2023-02-162-1/+15
| | | | | * discarding empty seqs now raises errors * the same goes for sets
* Fix `closeHandle` bug, add `setFileSize`, make `resize` work on Windows (#21375)c-blake2023-02-151-2/+3
| | | | | | | | | | | | | | * Add general purpose `setFileSize` (unexported for now). Use to simplify `memfiles.open` as well as make robust (via hard allocation, not merely `ftruncate` address space allocation) on systems with `posix_fallocate`. As part of this, fix a bad `closeHandle` return check bug on Windows and add `MemFile.resize` for Windows now that setFileSize makes that easier. * Adapt existing test to exercise newly portable `MemFile.resize`. * Since Apple has never provided `posix_fallocate`, provide a fallback. This is presently written in terms of `ftruncate`, but it can be improved to use `F_PREALLOCATE` instead, as mentioned in a comment.
* `std/asyncjs` allow transforming proc types (#21356)Jake Leahy2023-02-141-0/+5
| | | | | * Add test case * Implement JS async transform for nnkProcTy
* This adds `parseutils.parseSize`, an inverse to `strutils.formatSize` (#21349)c-blake2023-02-141-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * This adds `parseutils.parseSize`, an inverse to `strutils.formatSize` which has existed since 2017. It is useful for parsing the compiler's own output logs (like SuccessX) or many other scenarios where "human readable" units have been chosen. The doc comment and tests explain accepted syntax in detail. Big units lead to small numbers, often with a fractional part, but we parse into an `int64` since that is what `formatSize` stringifies and this is an inverse over partial function slots. Although metric prefixes z & y for zettabyte & yottabyte are accepted, these will saturate the result at `int64.high` unless the qualified number is a small fraction. This should not be much of a problem until such sizes are common (at which point another overload with the parse result either `float64` or `int128` could be added). Tests avoids `test()` because of a weakly related static: test() failure as mentioned in https://github.com/nim-lang/Nim/pull/21325. This is a more elemental VM failure. As such, it needs its own failure exhibition issue that is a smaller test case. (I am working on that, but unless there is a burning need to `parseSize` at compile-time before run-time it need not hold up this PR.) * This worked with `int` but fails with `int64`. Try for green tests. * Lift 2-result matching into a `checkParseSize` template and format as a table of input & 2 expected outputs which seems nicer and to address https://github.com/nim-lang/Nim/pull/21349#pullrequestreview-1294407679 * Fix (probably) the i386 trouble by using `int64` consistently. * Improve documentation by mentioning saturation. * Improve documentation with `runnableExamples` and a little more detail in the main doc comment based on excellent code review by @juancarlospaco: https://github.com/nim-lang/Nim/pull/21349#pullrequestreview-1294564155 * Address some more @juancarlospaco code review concerns. * Remove a stray space. * Mention milli-bytes in docs to maybe help clarify why wild conventions are so prone to going case-insensitive-metric. * Add some parens.
* allow omitting stmts using `finally` as post expr blocks; make it consistent ↵ringabout2023-02-141-0/+11
| | | | | with `else`, `except` etc. (#21361) allow omitting stmts using `finally` as post expr blocks
* megatest now checks refc too (#21341)ringabout2023-02-094-3/+13
| | | | | * megatest now checks refc too * fixes refc
* Add `contains` to `std/macrocache` (#21304)Jake Leahy2023-02-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add test cases * Implement contains for CacheSeq * Implement contains for CacheTable * Fix implementation of hasKey * Remove contains for CacheSeq Fix runnable examples I was accidently using --doccmd:skip so I didn't spot the failure locally * Implement hasKey as a VM callback instead of magic * Implement suggestions from PR Co-Authored-By: ringabout <ringabout@users.noreply.github.com> * Update lib/core/macrocache.nim --------- Co-authored-by: ringabout <ringabout@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* fixes #21317; 1.6.4 regression; etyBaseIndex should return fat pointers ↵ringabout2023-02-011-0/+15
| | | | | [backport 1.6] (#21320) fixes #21317; regression; etyBaseIndex should return fat pointers
* fixes #16790; fixes #19075; put big arrays on the constant seqs; don't ↵ringabout2023-01-311-0/+19
| | | | | | | inline them in the VM; big performance boost (#21318) * don't inline arrays in VM * add a test for #19075
* Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the ↵ringabout2023-01-272-44/+0
| | | | | | | default definition would be ill-formed " (#21307) Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the default definition would be ill-formed (#21169)" This reverts commit a7bae919adb952362cb53206140872d2b7424b47.
* Fix #13093 C++ Atomics: operator= is implicitly deleted because the default ↵Bung2023-01-272-0/+44
| | | | | | | | | | | | | definition would be ill-formed (#21169) * add test * fix #17982 Invalid C++ code generation when returning discardable var T * fix #13093 * cpp atomic good example * clearify the condition
* fixes #14409; fixes #10674 VM callbacks switch to table-index seqs (#21297)ringabout2023-01-261-1/+1
| | | | | | | * fixes #14409; fixes#10674 VM callbacks switch to table-index seqs * fixes package name * reduce runtime cost
* fixes #18134; registers `formatBiggestFloat` in VM (#21299)ringabout2023-01-261-8/+11
| | | | | fixes #18134; registers formatBiggestFloat in vmops strformat supports float format in VM
* fixes #21273; fixes an io.readLine off by one bug [backport 1.0] (#21276)ringabout2023-01-251-0/+18
| | | fixes #21273; io.readLine off by one
* fixes #21261; always checking `nimTestErrorFlag` in the main module (#21288)ringabout2023-01-242-0/+10
| | | | | * fixes #21261; always checking nimTestErrorFlag in the main module * add a test
* fixes #21290; deindent if the last same level is a text node (#21293)ringabout2023-01-241-1/+17
| | | | | * fixes #21290; deindent if the last same level is a text node * add one more test
* Update the reference to parseSpec (#21289)ghais2023-01-211-1/+1
| | | The current reference pointed to the wrong location
* fixes #21278; `deques.shrink` off by one bug (#21284)ringabout2023-01-201-0/+6
| | | fixes #21278; deques.shrink off ny one bug
* close #21257 (#21275)metagn2023-01-181-0/+20
| | | | | * close #21257 * fix generics
* fixes #21260; add check for illegal recursion for defaults (#21270)ringabout2023-01-181-0/+13
| | | | | * fixes #21260; add check for illegal recursion for defaults * fixes differently
* fixes #21263; consider all candidates for concept matches (#21265)ringabout2023-01-171-0/+25
|
* fix #20253 (#21174)Bung2023-01-131-0/+10
| | | | | | | | | * fix #20253 * change NimbleStableCommit * Update koch.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Fix getting custom pragma from generic object (#20481)Jake Leahy2023-01-111-0/+18
| | | | | | | | | | | * Merge devel Add another test case * Fix test Use getCustomPragmaVal instead of hasCustomPragma Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fix typeRel of typeDesc (#21227)Bung2023-01-091-0/+4
|
* fixes #21232; highlite.getNextToken() returns gtOperator for '/' in C (#21234)ringabout2023-01-081-0/+10
|
* fixes #21209; exclude threads options for JS (#21233)ringabout2023-01-082-0/+7
|
* underscores for routine parameters (#21192)metagn2023-01-081-0/+109
| | | | | | | | | * underscores for routine parameters fixes #13443, fixes #13804, refs #21121 * add changelog + more tests * support generics and ensure inferred lambdas work
* docgen: implement cross-document links (#20990)Andrey Makarov2023-01-042-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docgen: implement cross-document links Fully implements https://github.com/nim-lang/RFCs/issues/125 Follow-up of: https://github.com/nim-lang/Nim/pull/18642 (for internal links) and https://github.com/nim-lang/Nim/issues/20127. Overview -------- Explicit import-like directive is required, called `.. importdoc::`. (the syntax is % RST, Markdown will use it for a while). Then one can reference any symbols/headings/anchors, as if they were in the local file (but they will be prefixed with a module name or markup document in link text). It's possible to reference anything from anywhere (any direction in `.nim`/`.md`/`.rst` files). See `doc/docgen.md` for full description. Working is based on `.idx` files, hence one needs to generate all `.idx` beforehand. A dedicated option `--index:only` is introduced (and a separate stage for `--index:only` is added to `kochdocs.nim`). Performance note ---------------- Full run for `./koch docs` now takes 185% of the time before this PR. (After: 315 s, before: 170 s on my PC). All the time seems to be spent on `--index:only` run, which takes almost as much (85%) of normal doc run -- it seems that most time is spent on file parsing, turning off HTML generation phase has not helped much. (One could avoid it by specifying list of files that can be referenced and pre-processing only them. But it can become error-prone and I assume that these linke will be **everywhere** in the repository anyway, especially considering https://github.com/nim-lang/RFCs/issues/478. So every `.nim`/`.md` file is processed for `.idx` first). But that's all without significant part of repository converted to cross-module auto links. To estimate impact I checked the time for `doc`ing a few files (after all indexes have been generated), and everywhere difference was **negligible**. E.g. for `lib/std/private/osfiles.nim` that `importdoc`s large `os.idx` and hence should have been a case with relatively large performance impact, but: * After: 0.59 s. * Before: 0.59 s. So Nim compiler works so slow that doc part basically does not matter :-) Testing ------- 1) added `extlinks` test to `nimdoc/` 2) checked that `theindex.html` is still correct 2) fixed broken auto-links for modules that were derived from `os.nim` by adding appropriate ``importdoc`` Implementation note ------------------- Parsing and formating of `.idx` entries is moved into a dedicated `rstidx.nim` module from `rstgen.nim`. `.idx` file format changed: * fields are not escaped in most cases because we need original strings for referencing, not HTML ones (the exception is linkTitle for titles and headings). Escaping happens later -- on the stage of `rstgen` buildIndex, etc. * all lines have fixed number of columns 6 * added discriminator tag as a first column, it always allows distinguish Nim/markup entries, titles/headings, etc. `rstgen` does not rely any more (in most cases) on ad-hoc logic to determine what type each entry is. * there is now always a title entry added at the first line. * add a line number as 6th column * linkTitle (4th) column has a different format: before it was like `module: funcName()`, now it's `proc funcName()`. (This format is also propagated to `theindex.html` and search results, I kept it that way since I like it more though it's discussible.) This column is what used for Nim symbols resolution. * also changed details on column format for headings and titles: "keyword" is original, "linkTitle" is HTML one * fix paths on Windows + more clear code * Update compiler/docgen.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Handle .md and .nim paths uniformly in findRefFile * handle titles better + more comments * don't allow markup overwrite index title for .nim files Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #21207; reports redefinition error in the definition of enums (#21217)ringabout2023-01-031-0/+9
| | | | | * fixes #21207; reports redefinition in the enums * add a test
* fixes pragmas reorder (#21205)ringabout2023-01-011-0/+19
|