Commit Graph

644 Commits

Author SHA1 Message Date
flywind
f07a072691 [JS + docs] improve std/monotimes module (#17103) 2021-02-22 11:09:25 +01:00
Andrey Makarov
fab1618eb4 make rst.nim use object variant (#17138)
* make rst.nim use object variant

* add workaround

* fix mistake
2021-02-22 11:00:31 +01:00
flywind
32bf10126c fix #17118 (#17119) [backport:1.2]
* fix js unsigned integer
* Use `std` prefix for standard library modules
* fix #17118
2021-02-22 09:14:18 +01:00
Timothee Cour
cde950e1bc make copySign for js consistent with other backends (#16609)
* make copySign work more robustly in js
* improve tests
* improve tests/vm/tcastint.nim
2021-02-22 08:47:00 +01:00
flywind
146beb2797 remove unnecessary when statement (#17135) 2021-02-21 11:17:25 +01:00
Timothee Cour
e94a3e5fcd move prelude so that include std/prelude also works (#17110)
* move prelude so that `include std/prelude` also works

* add test
2021-02-20 18:08:13 +01:00
konsumlamm
bd199a8d31 Improve the strformat module (#17106)
* Improve the strformat module

Improve documentation
Use runnableExamples

* Fix overflow error for low(int64)

Add test

* Use assert in runnableExamples

* Improve tstrformat

Put tests in proc & test VM
Put tests in blocks
Add c, js targets

* Use doAssert in tests

* Disable JS & VM tests
2021-02-20 18:06:29 +01:00
Timothee Cour
6b3bdd798d enable bsd for tsetutils; improve setutils API (#17098) 2021-02-20 18:02:57 +01:00
Andrey Makarov
d1fec552d0 stricter checks for RST headlines (#17089) 2021-02-20 18:01:45 +01:00
Timothee Cour
0fcf1af765 uri: document removeDotSegments, add tests, show failure modes (#17064)
* uri: document removeDotSegments, add tests, show failure modes
* address comments
2021-02-20 17:58:54 +01:00
flywind
c1a06bd56e close #13859; add testcase (#17099)
* fix js unsigned integer

* better

* close #13859; add testcase
2021-02-19 11:36:35 +01:00
Jason Beetham
35ded02074 Add setutils.complement, setutils.fullSet (#17066) 2021-02-18 17:33:28 -08:00
flywind
301d784256 [nodejs backend] paramStr, paramCount (#17082) 2021-02-18 08:26:50 +01:00
flywind
35e14998ec fix math.frexp function signature (#16725) 2021-02-17 19:27:48 +01:00
flywind
4f118721be make system random work in VM (#17059)
* make system random work in VM
2021-02-17 11:52:46 +01:00
Benoit Favre
81703d4ad4 Fix bug in removeDotSegments: added test (#17050)
* Fix bug in removeDotSegments when path ends with dot

* Add test for trailing period bug in uri
2021-02-16 20:20:37 +01:00
konsumlamm
0a9a90d991 Improve documentation for bitops (#16961)
* Improve documentation for bitops

Use func
Use let in runnableExamples

* Remove unnecessary tests

Fix #7587
2021-02-15 21:17:45 +01:00
Andrey Makarov
35bd39a9d0 RST: implement footnotes and citations (#16960)
* RST: implement footnotes and citations
* manual fixup of nimdoc.out.css
* remove unused code
* shorter printing code
* Update lib/packages/docutils/rst.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-15 14:12:40 +01:00
konsumlamm
56f5010fa4 Improve the heapqueue module (#17034)
Improve documentation
Optimize toHeapQueue
Rename siftup and siftdown
Add tests for the heap property
2021-02-15 13:57:15 +01:00
konsumlamm
afa87f223c Improve math module (#17019)
* Improve documentation for math

Support empty input for cumsummed
Use runnableExamples
Move some examples to tests
Add more tests

* Update tests/stdlib/tmath.nim

Move some tests to trandom.nim
Move tests into main template where possible
Add test for #17017

* Add more tests for gamma & lgamma

Remove gamma(-1.0) example
Small fixes/changes

* Move more tests into template main()

* Fix typos

* Add edge case examples for copySign
2021-02-12 17:13:39 +01:00
Andrey Makarov
8053ccde2f parse RST headings when EOF follows them (#17014) 2021-02-12 15:08:09 +01:00
flywind
18c24eb4d0 add system random to stdlib: std/sysrand (#16459) 2021-02-11 16:00:01 -08:00
hlaaftana
49ee2f7f3b fix #16967 [backport:1.2] (#16976)
* fix #16967 [backport:1.2]

* move test to tsugar
2021-02-09 13:04:36 +01:00
Peter Salvi
e211a2a9f6 std/lists: Various changes to lists (RFC #303) (#16536)
* Various changes to `lists` (RFC #303)

* Removing a non-element is no-op; better tests

* Remove preserves cycles; add appendMove alias; tests.

* Return value for (singly linked) `lists.remove`

* More test for lists.remove

* Moved `lists.append` to the end of the file to see all `add` definitions

* Disable testing js for now

* Use workaround for swap js bug

* Smaller diff

* Undo "silent" deprecation of append

* Correct typo in changelog

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Remove `appendMoved`

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Don't remove appendMoved

Co-authored-by: Clyybber <darkmine956@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-02-08 22:24:16 +01:00
Andreas Rumpf
abac35e743 basic cleanups regarding SSL handling (#16940) [backport:1.0]
* basic cleanups regarding SSL handling
* enabled certificate checking on Windows
* updated the SSL test
* quoting helps
2021-02-08 13:54:03 +01:00
flywind
065264eae1 close #16921 (#16951) 2021-02-06 17:33:11 +01:00
Roman Inflianskas
e9b360c5df stdlib/os: handle symlinks in copy/move functions (#16709)
* stdlib/os: handle symlinks in copy/move functions

- Added optional `options` argument to `copyFile`, `copyFileToDir`, and
  `copyFileWithPermissions`. By default, symlinks are followed (copy files
  symlinks point to).
- `copyDir` and `copyDirWithPermissions` copy symlinks as symlinks (instead of
  skipping them as it was before).
- `moveFile` and `moveDir` move symlinks as symlinks (instead of skipping them
  sometimes as it was before).
- Added optional `followSymlinks` argument to `setFilePermissions`.

See also: https://github.com/nim-lang/RFCs/issues/319

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Address comments in #16709

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Address comments in #16709 (second iteration)

Skip symlinks on Windows.

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-02-04 18:57:41 +01:00
konsumlamm
f4449a897d Sugar tests (#16820) 2021-02-02 18:11:59 -08:00
Timothee Cour
4b2054a7bf dumpToString: improves on sugar.dump (#16841)
* dumpToString
* _
* fixup
* changelog
* address comment: removed the word "Deprecated"
2021-02-02 07:41:33 +01:00
konsumlamm
15d6be52a1 Improve doc comments (#16902)
Add runnableExamples
Use `reduce` in `initRational` and `//`
Add static tests
2021-02-02 07:04:30 +01:00
Timothee Cour
917f12ae52 2.5x- 3x faster copyFile on osx (#16883) 2021-02-01 17:38:17 -08:00
flywind
de4f2604c2 fix #16822 (#16884)
* see whether it breaks

* fix #16884

* correct

* fix #14574
2021-02-01 13:31:04 +01:00
flywind
296cf9657c add lost functions (#16843) 2021-01-29 15:14:19 +01:00
Timothee Cour
b0f38a63c4 fix #16815 round(x,places) works again in vm (#16825)
* fix #16815 round+places works again in vm

* improve tests; fix for linux 32bit

* fix test for windows
2021-01-28 10:40:18 +01:00
konsumlamm
3c8fddbc76 Improve documentation for the mersenne module (#16824)
* Improve documentation for mersenne

Add tests for mersenne

* Add link to Wikipedia article
2021-01-27 19:14:13 +00:00
Jason Beetham
ecc9704bf4 Moved json enum index test to the proper file (#16826) 2021-01-25 18:35:08 -08:00
Jason Beetham
dde096ffde added enum indexed array support to json (#16807)
* added enum indexed array support to json

* Added json test

* Removed when statement for enum indexed arrays
2021-01-26 00:55:49 +01:00
konsumlamm
d2b218b80a Improve the marshal module (#16777)
* Improve marshal

Use runnableExamples
Refactor tests

* Readd {.inheritable.} test

Apply suggestions
2021-01-22 19:52:34 +01:00
Timothee Cour
18b983d7e3 addQuitProc => addExitProc (#16765) 2021-01-22 19:51:11 +01:00
Daehee
2d0cb18b9f Fix SIGSEGV in httpclient response body (#16766)
* initialize httpclient response bodyStream; prevent SIGSEGV when getBody is false

* Update lib/pure/httpclient.nim

* Update lib/pure/httpclient.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-01-22 15:04:52 +01:00
Timothee Cour
14730d9d64 fix noDecl => nodecl (#16760)
* fix noDecl => nodecl

* address comment

* disable flaky tests/stdlib/thttpclient.nim on freebsd
2021-01-20 11:08:42 +01:00
Timothee Cour
6c07b0a1f8 jsonutils.jsonTo: support opt (#16739) 2021-01-17 11:37:06 +01:00
Timothee Cour
18e14f5920 js: improve tests + some docs (#16727)
* js: improve tests

* _

* _

* _

* fixup
2021-01-16 12:08:40 +01:00
Juan Carlos
78a99587a4 Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-15 18:56:38 -08:00
Juan Carlos
41965880ce Add js BigInts (#16409)
* Add BigInts
* Renames tos plurals
* Improve Stringifications
* Update changelog.md

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>

* RunnableExamplerize
* discard the discardable pragma
* Several improvements from peer reviews, more docs
* More doc, more test
* More doc, more test
* Better error message 'Error: usage of low is an {.error.} defined at jsbigints.nim' instead of just 'type mismatch JsBigInt'
* is an overload, rename
* proc to scare kids away
* Update lib/js/jsbigints.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* https://github.com/nim-lang/Nim/pull/16409#discussion_r554365041

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-01-14 20:19:41 +01:00
vabresto
a90f7a66ed Transfer-Encoding:chunked tests (#16678)
* Add tests and fix extra newlines in body

* Fixes per comments

* Slight rephrase per comments

* Improvements per comments

* Add getSocket to reduce test flakiness per comment

* Remove unused lines from header

* Add doc comment to getSocket per comment

* Apply witchcraft to replace `discard Future`

* Return HTTP 400 on bad encoding in request

* Fix runnable example for getSocket

* Fix import to fix runnable examples

* Even more imports for the example

* Better self documenting runnable example

* Add missing import

* Import from module with correct signature

* Resolve port type mismatch
2021-01-14 20:17:02 +01:00
Timothee Cour
94430a2e6d enable tests/stdlib/thttpclient.nim (#16710)
* enable tests/stdlib/thttpclient.nim

* disable windows, openbsd
2021-01-14 11:10:02 +01:00
Yuriy Glukhov
4ae520711d Fixes #16436 (#16695)
* Fixes #16436

* Comments addressed
2021-01-14 08:53:21 +01:00
Timothee Cour
fee5fbc722 fix #16703; revert most of #16480; add tests/stdlib/tmimetypes.nim (#16711) 2021-01-13 14:52:59 -08:00
Timothee Cour
61fd19c7e6 revive PR #16320 (CRLF fix); fix #16308; Update openssl.nim (#16648)
* Update openssl.nim

Fix issue # 16308

* Update openssl.nim

These are also related to Issues [#16308](https://github.com/nim-lang/Nim/issues/16308)

* Update openssl.nim

* Add files via upload

SSL PEM_read_RSAPUBKEY check

* Delete topenssl_rsa_private_key.pem
* Delete topenssl_rsa_public_key.pem
* Delete topenssl.nim
* Add files via upload
* Update topenssl.nim

This test makes me dizzy. Variables such as' PRSA 'must be declared in advance, otherwise they will run incorrectly. The argument uses a cString, and string also makes an error.

* Update topenssl.nim

```
lhf@lhf-pc:/media/lhf/D$ cat -e ./topenssl.nim
import std/wordwrap$
import openssl$
```

* Update topenssl.nim
* dos2unix tests/stdlib/topenssl.nim

Co-authored-by: lihaifeng <lihaifeng@wxm.com>
2021-01-12 20:11:30 +01:00