summary refs log tree commit diff stats
path: root/tests/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* make C++ atomic opt in via -d:nimUseCppAtomics (#24209)metagn2024-09-302-3/+6
| | | | | | | refs #24207 The `-d:nimUseCAtomics` flag added in #24207 is now inverted and made into `-d:nimUseCppAtomics`, which means C++ atomics are only enabled with the define. This flag is now also documented and tested.
* fixes #24174; allow copyDir and copyDirWithPermissions skipping special ↵ringabout2024-09-271-2/+13
| | | | | files (#24190) fixes #24174
* fix tmarshalsegfault depending on execution time (#24153)metagn2024-09-221-3/+2
| | | | | | | | | | Added in #24119, the test checks if every string produced is equal, but the value of the strings depend on the `now()` timestamp of when they were produced. 30 of them are produced in a for loop in sequence with each other, but the first one is set after the data is marshalled into and unmarshalled from a file. This means the timestamp strings can differ depending on the execution time and causes this test to be flaky. Instead we just make 2 strings from the same data and check if they equal each other.
* Create `IPPROTO_NONE` alias & Add test for Unix socket (#24139)tocariimaa2024-09-192-0/+61
| | | closes #24116
* fixes rst parsing Markdown CodeblockFields blocking the loop (#24128)ringabout2024-09-181-0/+12
| | | | | | | | | ```nim import packages/docutils/[rst, rstgen] let message = """```llvm-profdata""" echo rstgen.rstToHtml(message, {roSupportMarkdown}, nil) ```
* test case haul before 2.2 (#24119)metagn2024-09-171-0/+55
| | | | | closes #4774, closes #7385, closes #10019, closes #12405, closes #12732, closes #13270, closes #13799, closes #15247, closes #16128, closes #16175, closes #16774, closes #17527, closes #20880, closes #21346
* add posix uint changes to changelog + fix Nlink, Dev on FreeBSD (#24088)metagn2024-09-091-0/+6
| | | | | | | refs #24078, refs #24076 Since these changes are potentially breaking, add them to changelog, also add Nlink as mentioned in https://github.com/nim-lang/Nim/issues/24076#issuecomment-2337666555.
* fix int32's that should be uint32 on BSD & OSX (#24078)metagn2024-09-091-0/+8
| | | | | | | | | fixes #24076 As described in #24076, misannotating these types causes codegen errors. Sources for the types are https://github.com/openbsd/src/blob/master/sys for BSD and https://opensource.apple.com/source/Libinfo/Libinfo-391/ and [_types.h](https://opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/_types.h.auto.html) for OSX.
* streams: implement readStr for VM, document VM limitations (#24058)metagn2024-09-041-0/+4
| | | | | | | | | | | fixes #24054 `readData` is not implemented for the VM as mentioned in the issue, but `readDataStr` is, so that is used for `readStr` instead on the VM. We could also just use it in general since it falls back to `readData` anyway but it's kept the same otherwise for now. Also where and why streams in general don't work in VM is now documented on the top level `streams` module documentation.
* fixes symbolName for range enums (#24052)ringabout2024-09-031-0/+10
|
* fixes #14623; Top-level volatileLoad/volatileStore leads to invalid codegen ↵ringabout2024-08-281-0/+15
| | | | | (#24020) fixes #14623
* fixes #23915; std/random produces different results on c/js (#24003)ringabout2024-08-251-5/+10
| | | fixes #23915
* adds a ubuntu 24.04 matrix with gcc 14 for tests (#23673)ringabout2024-08-201-1/+4
| | | ref https://forum.nim-lang.org/t/11587
* fixes docgen regression: don't add newLine for code if it's the first line ↵ringabout2024-08-172-11/+6
| | | | | | | | | | | | | | | (#23154) Before (devel) ![image](https://github.com/nim-lang/Nim/assets/43030857/cde37109-027a-46c1-a37e-1d6062e6c609) After (this PR and stable) ![image](https://github.com/nim-lang/Nim/assets/43030857/3366877c-7223-4749-a584-fe93f731281f) It now keeps the same behavior as before
* fixes #23936; opcParseFloat accepts the wrong register as the first param ↵ringabout2024-08-121-0/+11
| | | | | | [backport] (#23941) fixes #23936 follow up https://github.com/nim-lang/Nim/pull/20527
* closes #6549; adds a test case (#23929)ringabout2024-08-091-1/+17
| | | closes #6549
* doc,test(times): followup #23861 (#23881)lit2024-07-231-1/+13
| | | followup #23861
* Fix out-of-bounds slicing in std/varints (#23868)Buldram2024-07-221-1/+1
| | | | | | Corrects a slicing mistake in the `std/varints` implementation which caused it to fail when writing large numbers into buffers smaller than 10..13-bytes, now 9-byte buffers are sufficient as the documentation states.
* Replacement PR for https://github.com/nim-lang/Nim/pull/23779 that (#23793)c-blake2024-07-075-9/+16
| | | | | | | makes new hash the default, with an opt-out (& js-no-big-int) define. Also update changelog (& fix one typo). Only really expect the chronos hash-order sensitive test to fail until they merge that PR and tag a new release.
* Comment out flaky test in tests/stdlib/thttpclient (#23772)Alexander Kernozhitsky2024-06-291-6/+6
| | | | | | | | | ``` $ curl -v http://example.com/404 |& grep 'HTTP/1.1' > GET /404 HTTP/1.1 < HTTP/1.1 500 Internal Server Error ``` So, the test with http://example.com/404 should be disabled, I think.
* Run tests with `nimPreviewHashFarm` on the 3 main back ends. (#23739)c-blake2024-06-221-1/+1
| | | | Assuming CI tests pass (they do for me locally), this should be merged to keep them passing.
* Add Farm Hash conditioned upon `nimPreviewHashFarm` as 64-bit `Hash` (#23735)c-blake2024-06-191-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Unlike present Nim this actually fills `Hash` for `string` & related. For the curious, note that `hashData` remains the aboriginal Nim string hasher & `import hashes {.all.}` allows simultaneous test/time of {orig, murmur, farm} on your favorite CPU & back end compiler. Update tests also conditioned upon `nimPreviewHashFarm` so they should pass either with or without that `define` on. In `--jsbigint=on` mode, only the lower 32-bits of `Hash` match nimvm & run-time values because `type Hash = int` and on JS int=int32, not int64 as for 64-bit Nim platforms. Due to the matching, `const` Table should match run-time `Table` on all platforms. To operate in `--jsbigint=off` mode is feasible but needs much "double precision mul/xor/ror/shr-arithmetic"-style work. That is distracting & also of questionable value since JS added BigInt in 2018, ringabout added Nim support for it in 2021 & `nimPreviewHashFarm` is unlikely to swap from an opt-in to an opt-out default before 2025..2026 which will have given a backward looking time window of 7..8 years for deployment platforms - reasonably generous. Add a changelog entry for 2.2.
* fixes #22672; Destructor not called for result when exception is thrown (#23267)ringabout2024-06-061-2/+2
| | | fixes #22672
* fixes #23663; Add hash() for Path (#23664)ringabout2024-05-311-5/+9
| | | fixes #23663
* Treat CJK Ideographs as letters in `isAlpha()` (#23651)Alexander Kernozhitsky2024-05-291-0/+2
| | | | | | | | | | | | | | | | | Because of the bug in `tools/parse_unicodedata.nim`, CJK Ideographs were not considered letters in `isAlpha()`, even though they have category Lo. This is because they are specified as range in `UnicodeData.txt`, not as separate characters: ``` 4E00;<CJK Ideograph, First>;Lo;0;L;;;;;N;;;;; 9FEF;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;; ``` The parser was not prepared to parse such ranges and thus omitted almost all CJK Ideographs from consideration. To fix this, we need to consider ranges from `UnicodeData.txt` in `tools/parse_unicodedata.nim`.
* fixes #23635; tasks.toTask Doesn't Expect a Dot Expression (#23641)ringabout2024-05-271-0/+36
| | | | | | | fixes #23635 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes testament matrix doesn't work with other backends which left many JS ↵ringabout2024-05-143-3/+7
| | | | | | tests untested (#23592) Targets are not changes, which means the C binary is actually tested for JS backend
* adds Nim-related mimetypes back (#23589)ringabout2024-05-101-0/+5
| | | ref https://github.com/nim-lang/Nim/pull/23226
* Add Complex version of almostEqual function (#23549)Angel Ezquerra2024-05-081-0/+3
| | | | | | | | This adds a version of `almostEqual` (which was already available for floats) thata works with `Complex[SomeFloat]`. Proof that this is needed is that the first thing that the complex.nim runnable examples block did before this commit was define (an incomplete) `almostEqual` function that worked with complex values.
* rework `wasMoved`, `move` on the JS backend (#23577)ringabout2024-05-081-11/+23
| | | | | `reset`, `wasMoved` and `move` doesn't support primitive types, which generate `null` for these types. It is now produce `x = default(...)` in the backend. Ideally it should be done by ast2ir in the future
* fixes #23556; typeinfo.extendSeq generates random values in ORC (#23557)ringabout2024-05-031-0/+17
| | | | | fixes #23556 It should somehow handle default fields in the future
* Fix std/base64.decode out of bounds read (#23526)bptato2024-04-221-0/+2
| | | | inputLen may end up as 0 in the loop if the input string only includes trailing characters. e.g. without the patch, decode(" ") would panic.
* fixes #4299 #12492 #10849; lambda lifting for JS backend (#23484)ringabout2024-04-111-0/+47
| | | | | | | | fixes #4299 fixes #12492 fixes #10849 It binds `function` with `env`: `function.bind(:env)` to ease codegen for now
* Update encodings.nim, fix `open` with bad arg raising no `EncodingError` ↵lit2024-04-061-0/+4
| | | | | | (#23481) On POSIX, `std/encodings` uses iconv, and `iconv_open` returns `(iconv_t) -1` on failure, not `NULL`
* fixes #16771; lower `swap` for JS backend (#23473)ringabout2024-04-031-0/+19
| | | | | | | | | | | | fixes #16771 follow up https://github.com/nim-lang/Nim/pull/16536 Ideally it should be handled in the IR part in the future I have also checked the double evaluation of `swap` in the JS runtime https://github.com/nim-lang/Nim/issues/16779, that might be solved by a copy flag or something. Well, it should be best solved in the IR so that it doesn't bother backends anymore.
* strformat: detect format string errors at compile-time (#23356)Jacek Sieka2024-03-031-1/+14
| | | | | | | | | | | | This also prevents unwanted `raises: [ValueError]` effects from bubbling up from correct format strings which makes `fmt` broadly unusable with `raises`. The old runtime-based `formatValue` overloads are kept for backwards-compatibility, should anyone be using runtime format strings. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #23275; Add `==` for Deque (#23276)Tomohiro2024-02-081-0/+49
|
* fix mime types data (#23226)Bung2024-01-191-0/+3
| | | | | | generated via https://github.com/bung87/mimetypes_gen source data: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co
* don't use previous bindings of `auto` for routine return types (#23207)metagn2024-01-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #23200, fixes #18866 #21065 made it so `auto` proc return types remained as `tyAnything` and not turned to `tyUntyped`. This had the side effect that anything previously bound to `tyAnything` in the proc type match was then bound to the proc return type, which is wrong since we don't know the proc return type even if we know the expected parameter types (`tyUntyped` also [does not care about its previous bindings in `typeRel`](https://github.com/nim-lang/Nim/blob/ab4278d2179639f19967431a7aa1be858046f7a7/compiler/sigmatch.nim#L1059-L1061) maybe for this reason). Now we mark `tyAnything` return types for routines as `tfRetType` [as done for other meta return types](https://github.com/nim-lang/Nim/blob/18b5fb256d4647efa6a64df451d37129d36e96f3/compiler/semtypes.nim#L1451), and ignore bindings to `tyAnything` + `tfRetType` types in `semtypinst`. On top of this, we reset the type relation in `paramTypesMatch` only after creating the instantiation (instead of trusting `isInferred`/`isInferredConvertible` before creating the instantiation), using the same mechanism that `isBothMetaConvertible` uses. This fixes the issues as well as making the disabled t15386_2 test introduced in #21065 work. As seen in the changes for the other tests, the error messages give an obscure `proc (a: GenericParam): auto` now, but it does give the correct error that the overload doesn't match instead of matching the overload pre-emptively and expecting a specific return type. tsugar had to be changed due to #16906, which is the problem where `void` is not inferred in the case where `result` was never touched.
* rationals: support Rational[SomeUnsignedInt] (#23046)shirleyquirk2023-12-151-0/+9
| | | | | | | | fixes #22227 rationale: - `3u - 4u` is supported why not`3u.toRational - 4u.toRational` - all of rationals' api is on SomeInteger, looks like unsigned is declared as supported - math on unsigned rationals is meaningful and useful.
* table.`mgetOrPut` without default val (#22994)inv20042023-11-301-0/+16
| | | | | | | | | | | RFC: https://github.com/nim-lang/RFCs/issues/539 - ~~mgetOrPutDefaultImpl template into `tableimpl.nim` to avoid macros~~ - mgetOrPut for `Table`, `TableRef`, `OrderedTable`, `OrderedTableRef` - `tests/stdlib/tmget.nim` tests update --------- Co-authored-by: inv2004 <>
* fix: std/marshal unmarshaling of ref objects (#22983)John Viega2023-11-261-1/+41
| | | | | | | | | | | | | | | | | | | Fixes #16496 ![Marshal doesn't properly unmarshal *most* ref objects; the exceptions being nil ones](https://github-production-user-asset-6210df.s3.amazonaws.com/4764481/285471431-a39ee2c5-5670-4b12-aa10-7a10ba6b5b96.gif) Test case added. Note that this test (t9754) does pass locally, but there are tons of failures by default on OS X arm64, mostly around the bohem GC, so it's pretty spammy, and could easily have missed something. If there are better instructions please do let me know. --------- Co-authored-by: John Viega <viega@Johns-MacBook-Pro.local> Co-authored-by: John Viega <viega@Johns-MBP.localdomain> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* remove unnecessary side-effects from base64.encode(mime) (#22986)tersec2023-11-251-0/+4
| | | Fixes https://github.com/nim-lang/Nim/issues/22985
* fixes #22939; fixes #16890; push should but doesn't apply to importc … ↵ringabout2023-11-191-16/+19
| | | | | | | | | | | | | | | | | | | | | | (#22944) …var/let symbols fixes #22939 fixes #16890 Besides, it was applied to let/const/var with pragmas, now it is universally applied. ```nim {.push exportc.} proc foo = let bar = 12 echo bar {.pop.} ``` For example, the `bar` variable will be affected by `exportc`.
* fixes #22947; static integers in quote do [backport] (#22948)ringabout2023-11-181-0/+13
| | | fixes #22947
* fixes #22932; treats closure iterators as pointers (#22934)ringabout2023-11-141-1/+7
| | | | | | | | fixes #22932 follow up https://github.com/nim-lang/Nim/pull/21629 --------- Co-authored-by: Nickolay Bukreyev <SirNickolas@users.noreply.github.com>
* closes #16919; followup #16820, test tsugar on all backends (#22829)ringabout2023-10-161-8/+8
| | | | closes #16919 followup #16820
* fixes #22778 regression: contentLength implementation type mismatched (#22780)ringabout2023-10-031-0/+1
| | | | fixes #22778 follow up https://github.com/nim-lang/Nim/pull/19835
* Make `typeRel` behave to spec (#22261)Ryan McConnell2023-09-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | The goal of this PR is to make `typeRel` accurate to it's definition for generics: ``` # 3) When used with two type classes, it will check whether the types # matching the first type class (aOrig) are a strict subset of the types matching # the other (f). This allows us to compare the signatures of generic procs in # order to give preferrence to the most specific one: ``` I don't want this PR to break any code, and I want to preserve all of Nims current behaviors. I think that making this more accurate will help serve as ground work for the future. It may not be possible to not break anything but this is my attempt. So that it is understood, this code was part of another PR (#22143) but that problem statement only needed this change by extension. It's more organized to split two problems into two PRs and this issue, being non-breaking, should be a more immediate improvement. --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #22687; js backend - std/bitops/bitsliced throws compile error … ↵ringabout2023-09-211-0/+4
| | | | | | | (#22722) …in typeMasked fixes #22687