summary refs log tree commit diff stats
path: root/tests/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Add staticFileExists and staticDirExists (#22278)Tomohiro2023-08-181-0/+8
|
* fix #19304 Borrowing std/times.format causes Error: illformed AST (#20659)Bung2023-08-101-0/+7
| | | | | | | | | * fix #19304 Borrowing std/times.format causes Error: illformed AST * follow suggestions * mitigate for #4121 * improve error message
* Fix searchExtPos so that it returns -1 when the path is not a file ext (#22245)Tomohiro2023-08-041-0/+32
| | | | | | | * Fix searchExtPos so that it returns -1 when the path is not a file ext * fix comparision expression * Remove splitDrive from searchExtPos
* Make `repr(HSlice)` always available (#22332)konsumlamm2023-08-041-2/+4
| | | Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* fixes #22360; compare with the half of randMax (#22361)ringabout2023-08-021-0/+18
| | | | | * fixes #22360; compare with the half of randMax * add a test
* fixes #19101; zero initialization union casts (#22185)ringabout2023-06-291-0/+26
| | | | | | | * zero initialization union casts * cleans up and adds a test case for #19101 * uses nimZeroMem
* Don't throw errors on RST tables in Markdown and RstMarkdown modes (#22165)Andrey Makarov2023-06-281-5/+28
| | | | | | | | | | | | | | | | | | | | | * Don't throw errors on RST tables in Markdown and RstMarkdown modes Additions to RST simple tables (#19859) made their parsing more restrictive, which can introduce problems with of some old nimforum posts, which have tables with sloppily aligned columns (like this one: https://github.com/nim-lang/nimforum/issues/330#issuecomment-1376039966). Also this strictness contradicts to Markdown style of not getting in the way (ignoring errors). So this PR proposes a new strategy of dealing with errors: * In Markdown and legacy (old default) RstMarkdown we try to continue parsing, emitting only warnings * And only in pure RST mode we throw a error I expect that this strategy will be applied to more parts of markup code in the future. * Don't return anything in `checkColumns`
* Fix regression in `std/times` (#22155)Jake Leahy2023-06-261-0/+4
| | | | | | | * Add simple test case Just so the regression doesn't happen again * Specify initDateTime is gcsafe in the forward declarations
* fix VM uint conversion size bug, stricter int gen on JS (#22150)metagn2023-06-251-0/+3
| | | | | | | | | | | * fix VM uint conversion bug, stricter int gen on JS fixes #19929 * fix float -> uint64 conversion too * no need to mask to source type * simpler diff with explanation, add test for described issue
* fix #20023 hash for generic tables (#20346)Bung2023-06-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | * fix #20023 hash for generic tables * use default computation * Update lib/pure/collections/tables.nim Co-authored-by: Dan Rose <dan@digilabs.io> * Update lib/pure/collections/tables.nim Co-authored-by: Dan Rose <dan@digilabs.io> * Update lib/pure/collections/tables.nim * Update lib/pure/collections/tables.nim * Update t20023.nim --------- Co-authored-by: Dan Rose <dan@digilabs.io> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* `strutils.split/rsplit` now return src on an empty sep (#22136)Zoom2023-06-212-12/+11
| | | | | | | | | | | | | | | This is a rebase of an earlier rejected PR. Following the discussion around it, this commit provides a valid output for and edge case of an empty separator for `split` and `rsplit` routines. The empty separator is interpreted as "split by no separators" and the initial string is returned. This is consistent with the behaviour of the `set[char]` version of `split`/`rsplit` routines and unifies them all. Compared to a commit merged earlier, this one has a benefit of not using assertions that will be removed in release builds and thus still not preventing possible infinite loops (which was the earlier behaviour for this edge case for separator of type `string`). Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Amend divmod (#22131)Ryan McConnell2023-06-201-4/+11
| | | | | | | * Add Overflow checks & test adjust * Avoiding nimvm differences in tests * distinguish DivByZeroDefect
* Add divmod (#22102)Ryan McConnell2023-06-171-1/+9
| | | | | | | | | | | | | | | | | | | | | | | * Adding divmod * Adding support to VM * Wrapped C structs and funcs * Fix javascript impl * Fixing struct compat * Segregate tests, better compiletime defs * Using `inline` and switch back to `func` * Apply suggestions from code review * Explicit structures --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* add const RLIMIT_STACK (#21772)Qinsi (James) ZHU2023-06-091-0/+24
| | | | | | | * add const RLIMIT_STACK * generate by detect.nim * add generated const for linux-amd64
* Nested `with` blocks (#22042)awr12023-06-081-0/+16
| | | | | * Implemented with-nesting in underscoredCalls() * Add tests for nested with
* some test cleanups & category reorganization (#22010)metagn2023-06-067-34/+77
| | | | | | | | | | | | | | | | | * clean up some test categories * mention exact slice issue * magics into system * move trangechecks into overflow * move tmemory to system * try fix CI * try fix CI * final CI fix
* make `proc` not implicitly convert to `pointer` with a preview define (#21953)metagn2023-05-301-1/+2
| | | | | | | | | * test `proc` not converting to `pointer` * ignore define for now to test * remove cstring * fixes, changelog
* alternative to #21914; split, rsplit now forbid an empty separator (#21961)ringabout2023-05-301-0/+14
|
* fix #21251 Compiler SIGSEGV when using SharedTable (#21876)Bung2023-05-231-0/+6
| | | fix #21251
* Weekday parse/format (replacement) (#21857)Carlo Capocasa2023-05-211-0/+24
| | | | | * parsing capability for iso week year * remove outdated test
* tasks that support return values (#21859)Andreas Rumpf2023-05-171-0/+18
| | | tasks.nim: Code cleanups and support expressions that produce a value
* clean up SOME pending/xxx/issue link comments (#21826)metagn2023-05-114-37/+48
| | | | | * clean up SOME pending/xxx/issue link comments * great
* fix #9423 followup #17594: distinct generics now work in VM (#21816)ringabout2023-05-101-2/+1
| | | | | | | | | * fix #9423 distinct generics now work in vm * fixes cpp tests --------- Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* fixes #21792; enable checks for sum, prod, cumsummed and cumsum (#21793)ringabout2023-05-051-1/+15
| | | | | | | * enable checks for sum, prod, cumsummed and cumsum * fixes #21792 * add test cases
* line info for strformat + fix issue with typed templates (#21761)metagn2023-05-022-0/+18
| | | | | * line info in strformat * also fix #20381
* fixes #19863; move sha1, md5 to nimble packages for 2.0 (#21702)ringabout2023-05-022-46/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move sha1, md5 to nimble packages * boot the compiler * fixes tests * build the documentation * fixes docs * lol, I forgot koch.nim * add `nimHasChecksums` define * clone checksums but maybe copying is better * bump nimble hash * use ChecksumsStableCommit * fixes tests * deprecate them * fixes paths * fixes koch
* handle quoted routine symbols and non symbols expressions as before (#21740)ringabout2023-04-281-0/+11
|
* stdlib tests now check refc too (#21664)ringabout2023-04-21128-27/+244
| | | | | | | | | | | * stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
* Fix RST/Markdown false heading detection (#21685)Andrey Makarov2023-04-182-1/+40
|
* custom pragmas: correct error condition, remove outdated symkind whitelist ↵metagn2023-04-131-4/+3
| | | | | | | | | | | | | | | (#21653) * test not restricting custom pragma applied symbols fixes #21652 * fix other test * different patch * fix tests * actually test #18212 and other routines
* fixes #21632; enforce deref for `wasMoved` in ORC (#21647)ringabout2023-04-121-1/+10
| | | fixes #21632; enforce deref for `wasMoved`
* int64/uint64 as bigint in JS (#21613)metagn2023-04-116-28/+26
| | | | | | | | | | | * int64/uint64 as bigint in JS * fix CI * convert to compile option * fix lie * smaller diff, changelog entry
* Fix option lists with additional indentation in Markdown (#21633)Andrey Makarov2023-04-111-0/+26
| | | | | | | | This is more Markdown-ish way to fix issue #21055, then PR #21625. It does not enable RST definition lists, instead it makes adding additional indentation (less than 4) right after a paragraph be ignored, as it's done for all block elements in Markdown. (In this case this tenet is applied to option lists that are not part of CommonMark spec by themselves).
* fixes #21638; `fromJson` should support empty objects (#21641)ringabout2023-04-111-0/+5
| | | | | * fixes #21638; `fromJson` should supports empty objects * complete the logic
* fixes #21564; std/bitops: Add explicit type masking for the JS target (#21598)chmod2222023-04-031-0/+28
| | | | | | | | | | | | | | | | | | | * std/bitops: Add explicit type masking for the JS target Typecasts on the JavaScript backend do not function the same way as they do on C and C++ backends, so for bitwise operations we may need to mask them back down into their allowed range when they get shifted outside it. Since they do work as expected on the other backends, a default bitmask of all 1's is casted down into the target type as an easily optimizable "& 0xFF" operation for these backends. * Fixup: this should still be a func * Run test case on js target * Adapt testcase to contributor guide and best practices * Simplify constrain logic and turn into actual no-op for the C side
* disable google request in thttpclient (#21572)metagn2023-03-281-4/+6
| | | was breaking macos CI
* fixes #21538; expand len template parameter once in newSeqWith (#21543)Eric N. Vander Weele2023-03-201-0/+5
| | | | | | | `len` could contain side effects and may result in different values when substituted twice in the template expansion. Instead, capture the result of substituting `len` once. closes: #21538
* Fix: #21541. Add support for xnVerbatimText (#21542)Mark Leyva2023-03-201-0/+15
| | | | to text and text= procs. Remove unnecessary LF for xnVerbatimText in $ proc.
* fixes quoted variables with typedesc types (#21493)ringabout2023-03-091-0/+8
|
* closes #20704; add a test case (#21480)ringabout2023-03-061-1/+12
|
* 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
* 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
* 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.
* 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.
* 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 #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
* fixes #21278; `deques.shrink` off by one bug (#21284)ringabout2023-01-201-0/+6
| | | fixes #21278; deques.shrink off ny one bug
* 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>
* fixes #21232; highlite.getNextToken() returns gtOperator for '/' in C (#21234)ringabout2023-01-081-0/+10
|