Commit Graph

8544 Commits

Author SHA1 Message Date
flywind
60ec3e2417 add warnings to std/sysrand (#17191)
* remove unnecessary when statement

* remove outdated codes

* add warnings to std/sysrand

* Update lib/std/sysrand.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-02-26 20:06:20 +01:00
Timothee Cour
ff3ace2232 fix code-block test bugs: fix #17183, fix https://github.com/timotheecour/Nim/issues/620 (#17184)
* fix code-block test bugs: fix #17183, fix https://github.com/timotheecour/Nim/issues/620

* cleanup
2021-02-26 16:05:20 +01:00
zetashift
c7d6e4c6a6 Fix unicode.split with seperators examples (#17176)
* Fix unicode.split with seperators examples

https://nim-lang.org/docs/unicode.html#split.i%2Cstring%2CRune%2Cint didn't work with the set constructor `{}` so replaced it with a string that's converted to an openArray compatible type containing `Rune`s.

* Add runnableExamples to unicode.split

* Add runnableExamples to split with single separator too

* Simplify runnableExamples unicode.split

* Improve the rest of the runnableExamples with the simplified code

* Simplify runnableExamples of unicode.split even more

* Formatted unicode.split example

* Update lib/pure/unicode.nim

Co-authored-by: zetashift <rishi2@laptop.localdomain>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-02-26 15:08:48 +01:00
Timothee Cour
63f1c38f4e hashes: support object default hash (#17175) 2021-02-26 08:45:37 +01:00
Timothee Cour
4a31088ac2 improve docs for sugar.collect (#17188) 2021-02-26 08:43:32 +01:00
Timothee Cour
b725e0ed4d make jsconsole.assertion errors less confusing in logs (#17179)
* make jsconsole.assertion errors less confusing in logs

* address comments

* fixup
2021-02-25 14:02:00 +01:00
flywind
f07bdbe945 clarify the docs of existsOrCreateDir a bit (#17182)
* remove unnecessary when statement

* remove outdated codes

* clarify the docs a bit
2021-02-25 13:58:31 +01:00
flywind
dcd3f26876 clean up wrapnils 2021-02-25 17:52:58 +08:00
Timothee Cour
bea037f856 refs #17114: workaround for arm64 which should segfault but does not (#17178)
* refs #17114: workaround for arm64 which should segfault but does not
* fixup
* Update lib/std/wrapnils.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-25 08:40:43 +01:00
flywind
60929953cb mark inline (#17180) 2021-02-24 21:52:23 -08:00
flywind
fcb5cf643c use single backtick (#17181) 2021-02-24 21:47:27 -08:00
Timothee Cour
578d1ee751 std/options: $some(3) is now "some(3)", etc. (#17147)
* std/options: $some(3) is now "some(3)", not "Some(3)", `$none(int)` is now `"none(int)"` instead of `"None[int]"`

* fix tests

* disable optionsutils
2021-02-24 22:17:16 +00:00
Timothee Cour
a4e6b242d5 asyncjs: add then, catch for promise pipelining (#16871)
* asyncjs: add then
* improve tests, changelog, API
* fix cryptic windows error: The parameter is incorrect
* address comments
2021-02-24 21:03:21 +01:00
flywind
99633d7682 remove deprecated stuff in unittest module (#17156)
* remove unnecessary when statement

* remove outdated codes

* remove deprecated stuff in testament

* fix
2021-02-24 21:02:33 +01:00
Timothee Cour
8942586fa6 wrapnils: add ??. which returns an Option (#16931)
* wrapnils: add option-like API with ??., isSome, get
* fix test after rebase
* cleanups
* fix changelog
* address comments regarding get vs unsafeGet
2021-02-24 14:02:32 +01:00
Timothee Cour
11a7fa68f6 fix #17159 items(cstring) works in VM (#17160)
* fix #17159 items(cstring) works in VM

* improve test coverage tests/stdlib/tcstring.nim; add helpers: whenRuntimeJs, whenVMorJs

* document items(cstring)

* address comments
2021-02-24 14:01:06 +01:00
flywind
3f38f8fbb7 add strbasics.strip (#16280) 2021-02-24 10:22:47 +01:00
flywind
46bd222c89 [stdlib] make cookies module modern (#17116)
* update cookies module
* introduce sameSite.Default

Co-authored-by: hlaaftana <10591326+hlaaftana@users.noreply.github.com>
2021-02-24 10:14:19 +01:00
Andreas Rumpf
b48a32053f fixes yet another SSL problem on Windows [backport:1.2] (#17167) 2021-02-24 10:12:47 +01:00
flywind
47c078e29c use single backtick (#17166) 2021-02-23 21:05:39 -08:00
Timothee Cour
c274e67198 add enumutils.items for sparse enums, typetraits.SomeSparseEnum (#17080)
* add enumutils.items for enum with holes
* changelog
* ref in lib.rst
* use `type SomeSparseEnum* = (not Ordinal) and enum` instead of concept
* address comment: rename back to enum with holes
2021-02-23 20:25:35 +01:00
Danil Yarantsev
4e619a6bea A few rst doc fixes (#17151)
* Fix a couple of rst formatting issues

* no need for the extra space
2021-02-23 08:59:13 +01:00
Timothee Cour
ce7caec4b3 add io.readChars overload (simpler, less error prone) (#16044)
* add simpler to use readChars overload

* use new readChars overload

* Update lib/wrappers/openssl.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2021-02-22 20:13:08 +01:00
konsumlamm
a1f4113705 Improve the ropes module (#17145)
* Improve ropes module

Improve wording
Update runnableExamples
Add index bound check for `[]`
Minor format changes

* Update tests/stdlib/tropes.nim

Run on C & JS target
Test in VM
Add tests for `[]`
2021-02-22 19:58:37 +01:00
rockcavera
d76d79336f fix #15215 (#17142)
* fix 15215

* fix test

* end line

* Update tests/stdlib/tnetconnect.nim

Co-authored-by: flywind <xzsflywind@gmail.com>

* Update lib/pure/net.nim

Co-authored-by: flywind <xzsflywind@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2021-02-22 17:40:57 +01:00
konsumlamm
05711d95e0 Add example for pattern matching on options (#17120)
* Add example for pattern matching on options

* Use code-block

* Apply suggestions

* Use block comments

* Fix example
2021-02-22 11:16:15 +01:00
Timothee Cour
ef5303114c fix prelude regression refs #16238: include prelude doesn't interfere with nim doc (#17111)
* fix bug1 from #16238 nim doc now works with include prelude

* fix for windows

* fixup
2021-02-22 11:10:34 +01:00
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
f26c25737c remove outdated codes (#17140)
* remove unnecessary when statement

* remove outdated codes
2021-02-22 09:40:11 +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
4556901572 use single backtick (#17141) 2021-02-21 19:53:28 -08:00
flywind
146beb2797 remove unnecessary when statement (#17135) 2021-02-21 11:17:25 +01:00
flywind
70ec17eede use single backtick (#17133) 2021-02-21 00:27:39 -08: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
a1a18cfe66 use single backtick (#17115) 2021-02-20 03:20:29 -08:00
alaviss
ccc0667c29 system/excpt: let the OS handle termination on signal (#16712) 2021-02-19 00:29:21 -08:00
dawidkotlin
95664e1524 add example of hashing an object by all of its fields with fields (#16643)
* add example of hashing an object by all of its fields with `fields`

* Update lib/pure/hashes.nim

* Update lib/pure/hashes.nim

* Update lib/pure/hashes.nim

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2021-02-19 07:59:33 +01:00
flywind
9450bf6c08 use single backtick (#17100) 2021-02-18 22:47:21 -08:00
Jason Beetham
35ded02074 Add setutils.complement, setutils.fullSet (#17066) 2021-02-18 17:33:28 -08:00
flywind
cd274a5ac9 fix stringify unsigned integer in JS and JS VM (#17086)
* fix js unsigned integer

* better
2021-02-18 20:13:52 +01:00
konsumlamm
f400b5c26b Improve documentation for options (#17036) 2021-02-18 02:10:50 -08:00
Andreas Rumpf
ed0a4e7311 fixes #16585 (#17074) 2021-02-18 10:02:51 +01:00
flywind
301d784256 [nodejs backend] paramStr, paramCount (#17082) 2021-02-18 08:26:50 +01:00
Timothee Cour
f455e03028 fix #17078 csources generation (#17079)
* fix #17078 csources generation

* fixup
2021-02-18 07:00:51 +01:00
Timothee Cour
4c568734f4 system: more runnableExamples + doc improvements (#17075) 2021-02-17 14:33:02 -08:00