Skip to content

Commit

Permalink
Merge remote-tracking branch 'main/devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
slangmgh committed Jan 29, 2019
2 parents 97c054b + a58f5b6 commit ab283b4
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ before_script:
- cd ..
- export PATH=$(pwd)/bin${PATH:+:$PATH}
- echo PATH:${PATH}
- set +e # prevents breaking after_failure

script:
- echo "travis_fold:start:nim_c_koch"
- nim c koch
- echo "travis_fold:end:nim_c_koch"
- ./koch runCI

before_deploy:
Expand All @@ -59,3 +62,6 @@ deploy: # https://nim-lang.github.io/Nim
keep-history: false
on:
branch: devel

# Extract failed tests
after_failure: nim c -r tools/ci_testresults.nim
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

- The procs `parseutils.parseBiggsetInt`, `parseutils.parseInt`, `parseutils.parseBiggestUInt` and `parseutils.parseUInt` now raise a `ValueError` when the parsed integer is outside of the valid range. Previously they sometimes raised a `OverflowError` and sometimes returned `0`.

- `streams.StreamObject` now restricts its fields to only raise `system.Defect`, `system.IOError` and `system.OSError`. This change only affects custom stream implementations.

- nre's `RegexMatch.{captureBounds,captures}[]` no longer return `Option` or
`nil`/`""`, respectivly. Use the newly added `n in p.captures` method to
check if a group is captured, otherwise you'll recieve an exception.
Expand Down
7 changes: 2 additions & 5 deletions config/nimdoc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1314,11 +1314,8 @@ dt pre > span.Identifier, dt pre > span.Operator {
color: #155da4;
font-weight: 700; }
dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }
dt pre > span.Operator ~ span.Identifier {
dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier,
dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }
Expand Down
8 changes: 4 additions & 4 deletions koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ proc bundleNimsuggest() =
nimCompile("nimsuggest/nimsuggest.nim", options = "-d:release")

proc buildVccTool() =
nimCompile("tools/vccexe/vccexe.nim")
nimCompileFold("Compile Vcc", "tools/vccexe/vccexe.nim")

proc bundleWinTools() =
# TODO: consider building under `bin` instead of `.`
Expand Down Expand Up @@ -208,10 +208,10 @@ proc buildTool(toolname, args: string) =

proc buildTools() =
bundleNimsuggest()
nimCompile("tools/nimgrep.nim", options = "-d:release")
nimCompileFold("Compile nimgrep", "tools/nimgrep.nim", options = "-d:release")
when defined(windows): buildVccTool()
nimCompile("nimpretty/nimpretty.nim", options = "-d:release")
nimCompile("tools/nimfind.nim", options = "-d:release")
nimCompileFold("Compile nimpretty", "nimpretty/nimpretty.nim", options = "-d:release")
nimCompileFold("Compile nimfind", "tools/nimfind.nim", options = "-d:release")

proc nsis(latest: bool; args: string) =
bundleNimbleExe(latest)
Expand Down
37 changes: 16 additions & 21 deletions lib/pure/streams.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,22 @@ type
## here shouldn't be used directly. They are
## accessible so that a stream implementation
## can override them.
closeImpl*: proc (s: Stream) {.nimcall, tags: [], gcsafe.}
atEndImpl*: proc (s: Stream): bool {.nimcall, tags: [], gcsafe.}
setPositionImpl*: proc (s: Stream, pos: int) {.nimcall, tags: [], gcsafe.}
getPositionImpl*: proc (s: Stream): int {.nimcall, tags: [], gcsafe.}
readDataImpl*: proc (s: Stream, buffer: pointer,
bufLen: int): int {.nimcall, tags: [ReadIOEffect], gcsafe.}
peekDataImpl*: proc (s: Stream, buffer: pointer,
bufLen: int): int {.nimcall, tags: [ReadIOEffect], gcsafe.}
writeDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int) {.nimcall,
tags: [WriteIOEffect], gcsafe.}
flushImpl*: proc (s: Stream) {.nimcall, tags: [WriteIOEffect], gcsafe.}
closeImpl*: proc (s: Stream)
{.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.}
atEndImpl*: proc (s: Stream): bool
{.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.}
setPositionImpl*: proc (s: Stream, pos: int)
{.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.}
getPositionImpl*: proc (s: Stream): int
{.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.}
readDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int): int
{.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.}
peekDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int): int
{.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.}
writeDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int)
{.nimcall, raises: [Defect, IOError, OSError], tags: [WriteIOEffect], gcsafe.}
flushImpl*: proc (s: Stream)
{.nimcall, raises: [Defect, IOError, OSError], tags: [WriteIOEffect], gcsafe.}

proc flush*(s: Stream) =
## flushes the buffers that the stream `s` might use.
Expand All @@ -65,10 +70,6 @@ proc close*(s: Stream) =
## closes the stream `s`.
if not isNil(s.closeImpl): s.closeImpl(s)

proc close*(s, unused: Stream) {.deprecated.} =
## closes the stream `s`.
s.closeImpl(s)

proc atEnd*(s: Stream): bool =
## checks if more data can be read from `f`. Returns true if all data has
## been read.
Expand Down Expand Up @@ -111,12 +112,6 @@ proc writeData*(s: Stream, buffer: pointer, bufLen: int) =
## to the stream `s`.
s.writeDataImpl(s, buffer, bufLen)

proc writeData*(s, unused: Stream, buffer: pointer,
bufLen: int) {.deprecated.} =
## low level proc that writes an untyped `buffer` of `bufLen` size
## to the stream `s`.
s.writeDataImpl(s, buffer, bufLen)

proc write*[T](s: Stream, x: T) =
## generic write procedure. Writes `x` to the stream `s`. Implementation:
##
Expand Down
7 changes: 2 additions & 5 deletions nimdoc/testproject/expected/subdir/subdir_b/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -1139,11 +1139,8 @@
color: #155da4;
font-weight: 700; }

dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

dt pre > span.Operator ~ span.Identifier {
dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier,
dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

Expand Down
7 changes: 2 additions & 5 deletions nimdoc/testproject/expected/testproject.html
Original file line number Diff line number Diff line change
Expand Up @@ -1139,11 +1139,8 @@
color: #155da4;
font-weight: 700; }

dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

dt pre > span.Operator ~ span.Identifier {
dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier,
dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

Expand Down
7 changes: 2 additions & 5 deletions nimdoc/testproject/expected/theindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -1139,11 +1139,8 @@
color: #155da4;
font-weight: 700; }

dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

dt pre > span.Operator ~ span.Identifier {
dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier,
dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
color: inherit;
font-weight: inherit; }

Expand Down
24 changes: 24 additions & 0 deletions tools/ci_testresults.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Print summary of failed tests for CI

import os, json, sets, strformat

const skip = toSet(["reDisabled", "reIgnored", "reSuccess", "reJoined"])

when isMainModule:
for fn in walkFiles("testresults/*.json"):
let entries = fn.readFile().parseJson()
for j in entries:
let res = j["result"].getStr()
if skip.contains(res):
continue
echo fmt """
Category: {j["category"].getStr()}
Name: {j["name"].getStr()}
Action: {j["action"].getStr()}
Result: {res}
-------- Expected -------
{j["expected"].getStr()}
--------- Given --------
{j["given"].getStr()}
-------------------------
"""
9 changes: 7 additions & 2 deletions tools/kochdocs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ proc execFold*(desc, cmd: string, errorcode: int = QuitFailure, additionalPath =
## Execute shell command. Add log folding on Travis CI.
# https://github.com/travis-ci/travis-ci/issues/2285#issuecomment-42724719
if existsEnv("TRAVIS"):
echo "travis_fold:start:" & desc.replace(" ", "")
echo "travis_fold:start:" & desc.replace(" ", "_")
exec(cmd, errorcode, additionalPath)
if existsEnv("TRAVIS"):
echo "travis_fold:end:" & desc.replace(" ", "")
echo "travis_fold:end:" & desc.replace(" ", "_")

proc execCleanPath*(cmd: string,
additionalPath = ""; errorcode: int = QuitFailure) =
Expand All @@ -69,6 +69,11 @@ proc nimCompile*(input: string, outputDir = "bin", mode = "c", options = "") =
let cmd = findNim() & " " & mode & " -o:" & output & " " & options & " " & input
exec cmd

proc nimCompileFold*(desc, input: string, outputDir = "bin", mode = "c", options = "") =
let output = outputDir / input.splitFile.name.exe
let cmd = findNim() & " " & mode & " -o:" & output & " " & options & " " & input
execFold(desc, cmd)

const
pdf = """
doc/manual.rst
Expand Down

0 comments on commit ab283b4

Please sign in to comment.