Commit Graph

617 Commits

Author SHA1 Message Date
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
Mildred Ki'Lya
71db2be833 Improve uri.parseQuery to never raise an error (#16647)
In case of malformed query string where there is `=` on the value, handle
this character as part of the value instead of throwing an error.

The following query string should no longer crash a program:

    key=value&key2=x=1

It will be interpreted as [("key", "value"), ("key2", "x=1")]

This is correct according to latest WhatWG's HTML5 specification
recarding the urlencoded parser:
https://url.spec.whatwg.org/#concept-urlencoded-parser

Older behavior can be restored using the -d:nimLegacyParseQueryStrict
flag.
2021-01-12 13:42:05 +01:00
Andrey Makarov
fd5c8ef208 RST: implement internal targets (#16614) 2021-01-11 19:51:04 +01:00
flywind
be6e8916fa fix negative nan (#16628) 2021-01-11 11:39:38 +01:00
Timothee Cour
f6c2450cdb fix #16555, fixes #16405: len, high honors '\0' for cstring in vm (#16610) 2021-01-11 10:16:20 +01:00
Antonis Geralis
7bde6aa37f Httpclient improvements (#15919)
* Allow passing Uri instead of strings

* Teach httpclient about 308

* Deprecate request proc where httpMethod is string

* More use of HttpMethod enum

Also fix handling of 308, I forgot to add the hunk to the previous
commit.

* Well behaved redirect handler

* Also remove Transfer-Encoding

* Removed unused proc

* Secure redirection rules

Strip sensitive headers for cross-domain redirects.

* Allow httpMethod to be a string again

This way unknown http verbs can be used without any problem.

* Respect user-specified Host header

* Missed multipart argument.

* Try another method

* add changelog

* Fix hidden deprecation warning, parseEnum failing

* This is wrong

* Have to do it manually, parseEnum is not suitable

* Review comments

* update

Co-authored-by: LemonBoy <thatlemon@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-10 13:40:53 +00:00
rockcavera
0da4cb93d1 minor fix (#16624) 2021-01-07 19:16:26 +01:00
PMunch
0e7902b976 Implements streams for sockets (#15729) 2021-01-07 16:09:57 +01:00
flywind
89a21e4ec7 oids: switch from PRNG to random module (#16203)
* switch from PRNG to random module
* fix the regression
* comments + tests
* runnableExamples
* make oids better
2021-01-07 09:38:31 +01:00
flywind
bab0aa6ecf add math.signbit (#16592) 2021-01-07 08:48:02 +01:00
inv2004
04b765c16d Jsonutils: pass opt for object in object (#16615)
* jsonutils: fromJson forward opt param fix

* jsonutils: object in object test + fix: opt pass
2021-01-07 03:09:02 +01:00
inv2004
0d5cab77f6 jsonutils: fromJson forward opt param fix (#16612) 2021-01-06 18:42:49 +01:00
konsumlamm
2c2baa9fad Link the <fenv.h> header (#16597) 2021-01-05 20:51:51 +01:00
flywind
c04f305bf7 make cstrutils work in VM (#16590)
* make cstrutils work in VM

* more
2021-01-05 17:52:26 +01:00
konsumlamm
0c4bd65e8d Improve documentation for complex (#16588)
* Improve documentation for complex

Add missing doc comments

* Add runnableExample

Add links for principal values
Optimize `-`
Change var to let

* Use std prefix for imports
2021-01-05 17:50:15 +01:00
flywind
df9e74b510 fix #9125 (#16582)
* fix #9125

* Update tests/stdlib/tmath.nim

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

* back

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-01-05 17:47:10 +01:00
Clyybber
9f1dd5c00f Make tmath test more strict (#16593)
Don't use approximate equality when comparing
numbers that are representable with perfect precision.
2021-01-05 15:52:24 +01:00
Timothee Cour
b2a53795dc merge tmath_misc.nim into tmath.nim (#16591) 2021-01-05 14:29:21 +01:00
Timothee Cour
00144ee4e9 fix #16576: honor matrix in testament by making such tests non joinable (#16577)
* refs #16576: honor matrix in testament by making such tests non joinable

* add tests + misc fixes

* fix test for i386 with -d:danger
2021-01-04 19:45:46 +01:00
flywind
7c2c1ad072 enable tmath tests for JS backend (#16562) 2021-01-04 11:40:56 +01:00
konsumlamm
435f829348 Improve sequtils documentation (#16559)
* Improve sequtils documentation

Uncomment assertions in tests

* Use present tense
2021-01-04 11:04:30 +01:00
konsumlamm
2eccef7ad6 Algorithm improvements (#16529)
* Improve documentation for algorithm

Remove unused import in algorithm tests
Improve formatting

* Reapply fix for reverse on empty openArray

* Use 3rd person singular

Add more explanations.
2021-01-02 20:28:59 +01:00
flywind
e869767aa7 fix #16061 (#16551) 2021-01-02 17:13:01 +01:00
flywind
b8775bff57 fix is "closure" (#16552) 2021-01-02 17:11:46 +01:00
flywind
d8b1ffc857 fix #16542 (#16549)
* fix #16542
2021-01-02 14:32:37 +01:00
flywind
b5101b23b5 refactor the tests of options (#16527) 2021-01-01 19:01:07 +01:00
flywind
9d4a1f9554 fix #16494 (#16513)
* fix #16494

* fix

* fix

* fix

* fix

* fix

* fix performance

* add comments

* improve performance

* Update lib/system.nim

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

* Update lib/system.nim

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

* Update tests/stdlib/tmath_misc.nim

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

* Update tests/stdlib/tmath_misc.nim

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

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-01-01 10:59:19 +01:00
flywind
5fb56a3b2c refactor cmpIgnoreStyle and cmpIgnoreCase (#16399)
* init

* support strutils

* more

* better

* Call len once per string/cstring

* Change var to let

* Compare ternary on first char

* More appropriate param name

* fix

* better

* one test

* impl

* more efficient

* minor

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-12-31 11:54:40 +01:00