Commit Graph

265 Commits

Author SHA1 Message Date
Federico Ceratto
d65429d857 Add normalizePath and tests 2018-07-06 20:21:39 +01:00
Andreas Rumpf
963f431443 Merge branch 'araq-devel' of github.com:nim-lang/Nim into araq-devel 2018-07-06 17:27:02 +02:00
Andreas Rumpf
32230ffe31 make tests green again 2018-07-06 17:26:45 +02:00
Araq
8bcaee1fdf make tmemfile2 work again 2018-07-06 15:53:32 +02:00
Andreas Rumpf
20950ee073 make test green for OSX 2018-07-06 11:26:36 +02:00
Andreas Rumpf
86a7054c88 Merge branch 'devel' into araq-devel 2018-07-04 19:25:53 +02:00
Tomohiro
c79f488027 Fix os.unixToNativePath proc returns wrong result(#8179) (#8181)
* Fix os.unixToNativePath proc returns wrong result(#8179)

* Add tests for unixToNativePath
2018-07-02 17:14:26 +02:00
Andreas Rumpf
c7298561c1 system.nim: remove deprecated symbols 2018-06-28 07:42:46 +02:00
gemath
db68bbe4f7 Pegs AST read access (#8050)
* Make PEG AST nodes readable from outside the module.

* Added a test module for the pegs stdlib module.

* Edited changelog.

* Renamed ``sons`` iterator to ``items``, added ``pairs``, inlined both.

* Updated entry and moved it to the right category.
2018-06-19 18:13:33 +01:00
Dmitry Atamanov
bf5d619a52 Add MemMapFileStream. Fixes in memFiles. (#7944)
* Add MemMapFileStream

* Added tests

* Fixed bug in memfiles (zero index for string)

* Added flush to changelog

* Attempt to fix Win's nuances

* Fix attempt to fix

* Continue...

* And again...

* Reworked tests (all for win on Win)

* Fixes in flush (Win)

* Replace fn vars to consts

* Added the attempts parameter to the flush

* Replace while to for

* Move to memfiles

* Use Natural instead of uint

* Better error messages for append mode. Handle specific cases.
2018-06-14 17:34:26 +01:00
Vindaar
e80be6173d Add parse bin int, fixes #8018 (#8020)
* clarify `parseHexInt`, `parseOctInt` docstring and exception msgs

* add `parseBinInt` based on `parseutil.parseBin` implementation

Adds a `parseBinInt`, which parses a binary integer string and returns
it as an integer. This is based on the implementation of
`parseutil.parseBin`, removing the unnecessary parts.

* add tests for all `parse(Hex|Oct|Bin)Int` procs

* replace `parse*Int` proc impls by call to parseutil procs

Replaces the `parse(Hex|Oct|Bin)Int` procedure implementation by calls
to the `parseutil` procs, which receive a mutable argument.

Has the main advantage that the empty string as well as a "prefix
only" string, e.g. "0x" counts as an invalid integer.

Also moves the `parseOctInt` proc further up in the file so that all
`parse` procs are below one another.

* replace `var L` by `let L` in `parse` procs

There's no reason for the usage of `var` here.

* add `maxLen` optional arg for `parseutil.parse(Oct|Bin)`

Plus small change to test cases.

* update changelog about `parse*Int` procs

* fix `rejectParse` template in `tstrutils`

* make sure only `s.len` chars are parsed, if `maxLen+start` > s.len

Fixes a previous bug in `parseHex` (and now affected `parseOct` and
`parseBin`), which allowed to set `start + maxLen` to be larger than
the strings length. This resulted in an out of bounds access.

* move `parse*Int` proc change to breaking changes, add double `
2018-06-13 13:32:12 -04:00
Yuriy Glukhov
b2323de914 Fixed compilation error when Sockaddr_in4 or Sockaddr_in6 passed to fromSockAddr 2018-06-07 21:10:00 +03:00
skilchen
230692a22f Fix strformat neg zero (#7954)
* fix strformat handling of neg zero with sign

* better tests for neg zero with sign

* use inplace insertion of the sign as suggested by Varriount
2018-06-05 00:09:07 -04:00
skilchen
fd102f39bb Fix strformat precision handling for strings (#7941)
* fix strformat precision handling for strings

* add some limited unicode awareness to the precision handling for strings

* improvement suggested by Varriount: use setLen and runeOffset instead of runeSubstr
2018-06-04 18:26:16 -04:00
Oscar Nihlgård
05b447374b Use higher time resolution when available in os.nim (#7709) 2018-06-04 14:56:56 +02:00
skilchen
07ff9940f4 fix strformat zeropadding for floats (#7934) 2018-06-01 22:23:50 -04:00
七秒不觉梦
b6b6382e0b Added: type name output when exception raised from unittest (#7869) 2018-05-28 05:24:04 +03:00
Dominik Picheta
f7f69b1abb Merge pull request #7624 from skilchen/fix-issue7620
there is no hour 0 in am/pm time (see #7620)
2018-05-03 16:07:27 +01:00
Araq
ed79201d0b make more tests green 2018-04-30 11:16:56 +02:00
Andreas Rumpf
5237ef4f52 update the documentation about the new strings/seqs behaviours 2018-04-29 08:14:00 +02:00
Oscar Nihlgård
b34580fd5b Rename Time.nanoseconds to nanosecond (#7673)
* Rename `Time.nanoseconds` to `nanosecond`

* Fix bug with Duration comparision
2018-04-25 02:43:26 +02:00
Oscar Nihlgård
7d034d7b6a Add fromWinTime and deprecate unixTimeToWinTime/winTimeToUnixTime (#7641) 2018-04-19 22:41:06 +02:00
skilchen
bf6e82a861 there is no hour 0 in am/pm time 2018-04-16 17:40:54 +02:00
Oscar Nihlgård
02d6dd723d Timeinterval optimization (#7608)
* TimeInterval optimization

* Fix typo in `$`(Duration)
2018-04-16 00:01:34 +02:00
Oscar Nihlgård
f6df2d9956 Sub second time resolution (#6978)
* Add deprecation warnings to recently deprecated procs

* Fix bad usage of the times module

* Introduce sub second resolution

* Fix usage of C's time()

* Switch to nanosecond resolution

* Make Time & Duration opaque again and fix some errors

* Change back to TimeInterval for shorthands

* Fix JS test

* Fix build error for windows

* Undeprecate epochTime

* Documentation and minor changes

* Lots of bugfixes and doc comments

* Attempt to make travis & appveyor green

* Fix edge cases for dealing with the local timezone

* Workaround JS backend overflow/underflow bug

* Use better workaround for not knowing the size of time_t

* Use all available timezones for tests

* Fix indentation

* Add procs for accessing the fractional part of a duration

* Order time units from smallest to largest since it makes more sense

* Include months and years in `TimeUnit`

* Review fix
2018-04-13 07:36:30 +02:00
treeform
f3db632b1d Added count(*) support to sql parser. Fixed warnings in sql parser. (#7490) 2018-04-12 17:49:24 +02:00
Dominik Picheta
58dc8a399e Merge pull request #7450 from cabhishek/devel
Fixes #6902
2018-04-04 22:36:18 +01:00
Dominik Picheta
7ef0cfebb5 Merge pull request #7495 from GULPF/fix-fill-bug
Fix algorithm.fill for empty input
2018-04-04 13:54:40 +01:00
Oscar Nihlgård
da077eea7c Move algorithm tests away from koch 2018-04-04 13:00:51 +02:00
Dominik Picheta
39c71d6211 Merge pull request #7336 from yglukhov/ipaddr-sockaddr-conversions
Conversion procs for (IpAddress, Port) <-> (SockAddr, Socklen)
2018-04-02 14:31:05 +01:00
data-man
759023e157 Comparing datetimes 2018-04-01 00:41:38 +03:00
Abhishek Kapatkar
c7cba5e6f0 Fixes #6902 2018-03-30 13:43:01 -07:00
Dominik Picheta
9c2cdc94a2 Fixes #7433. 2018-03-29 11:57:53 +01:00
Yuriy Glukhov
1bd0efb067 Fixed crash/interface. Added tests. 2018-03-15 15:49:41 +02:00
twetzel59
9079517d71 Resolves #5588: adds openFileStream proc that throws on failure (#7282) 2018-03-04 17:30:28 +01:00
data-man
b30b920751 Fix date parsing for a bad inputs 2018-02-19 16:57:17 +03:00
Oscar Nihlgård
8247323860 Fix json.to for types with generic parameters 2018-02-11 23:15:04 +01:00
Dominik Picheta
1a565d7b20 Merge pull request #6517 from FedericoCeratto/hexstr
Add string-to-hex and back conversions
2018-01-26 15:32:28 +00:00
Araq
9a60eae631 fixes #7078 2018-01-14 23:49:53 +01:00
Araq
425f221440 Merge branch 'devel' of github.com:nim-lang/Nim into devel 2018-01-11 18:05:26 +01:00
Araq
fb8def869c rename strformat.fmt to % as it works better with backslash escape sequences; refs #6958 2018-01-11 18:05:14 +01:00
Dominik Picheta
24cae4addb Merge pull request #7033 from GULPF/allow-timezone-closures
Allow timezone procs to be closures
2018-01-10 17:45:29 +00:00
Oscar Nihlgård
624bd847fb Add test case 2018-01-09 00:33:39 +01:00
Oscar Nihlgård
c344fb311d Allow timezone procs to be closures 2018-01-05 10:07:46 +01:00
Araq
8bcaadc9e4 memfiles: enable test; refs #6361 2018-01-03 13:31:03 +01:00
Mathias Stearn
6bd3a2826f cmp(x, y: string) now uses memcmp rather than strcmp (#6869) (#6968) 2017-12-24 15:23:17 +01:00
Dominik Picheta
8d992c4176 Merge pull request #6725 from FedericoCeratto/unittest-5114
Add unittest suite/test name filters
2017-12-22 15:26:45 +00:00
skilchen
a89b81eb96 fixes #6353 (#6951) 2017-12-21 16:32:26 +01:00
GULPF
a879973081 Better times module (#6552)
* First work on better timezones

* Update tests to new api.
Removed tests for checking that `isDst` was included when formatting, since `isDst` no longer affects utc offset (the entire utc offset is stored directly in `utcOffset` instead).

* Deprecate getLocaltime & getGmTime
* Add `now()` as a shorthand for GetTIme().inZone(Local)
* Add FedericoCeratto's timezone tests (#6548)
* Run more tests in all timezones

* Make month enum start at 1 instead of 0
* Deprecate getDayOfWeekJulian
* Fix issues with gc safety
* Rename TimeInfo => DateTime
* Fixes #6465
* Improve isLeapYear
* FIx handling negative adjTime

* Cleanup:
- deprecated toSeconds and fromSeconds, added fromUnix and toUnix instead (that returns int64 instead of float)
- added missing doc comments
- removed some unnecessary JS specific implementations

* Fix misstake in JS `-` for Time

* Update usage of TimeEffect
* Removed unecessary use of `difftime`
* JS fix for local tz
* Fix subtraction of months
* Fix `days` field in `toTimeInterval`
* Style and docs
* Fix getDayOfYear for real this time...
* Fix handling of adding/subtracting time across dst transitions
* Fix some bad usage of the times module in the stdlib
* Revert to use proper time resoultion for seeding in random.nim
* Move deprecated procs to bottom of file
* Always use `epochTime` in `randomize`
* Remove TimeInterval normalization
* Fixes #6905

* Fix getDayOfWeek for year < 1
* Export toEpochDay/fromEpochDay and change year/month/monthday order
* Add asserts for checking that the monthday is valid
* Fix some remaining ambiguous references to `Time`
* Fix ambiguous reference to Time
2017-12-18 23:11:28 +01:00
Araq
8caa3df1c3 Merge branch 'parsesql' of https://github.com/treeform/Nim into treeform-parsesql 2017-12-15 16:49:59 +01:00