atlas tool: testing via mocking (#18588)
* atlas: refactoring * Atlas: do some basic testing via mocking
This commit is contained in:
parent
d4c3a09286
commit
664dbb6bfb
13 changed files with 387 additions and 58 deletions
32
tools/atlas/tests/balls.nimble
Normal file
32
tools/atlas/tests/balls.nimble
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
version = "3.4.1"
|
||||
author = "disruptek"
|
||||
description = "a unittest framework with balls 🔴🟡🟢"
|
||||
license = "MIT"
|
||||
|
||||
# requires newTreeFrom
|
||||
requires "https://github.com/disruptek/grok >= 0.5.0 & < 1.0.0"
|
||||
requires "https://github.com/disruptek/ups < 1.0.0"
|
||||
requires "https://github.com/planetis-m/sync >= 1.0.0 & < 2.0.0"
|
||||
#requires "https://github.com/c-blake/cligen < 2.0.0"
|
||||
|
||||
bin = @["balls"] # build the binary for basic test running
|
||||
installExt = @["nim"] # we need to install balls.nim also
|
||||
skipDirs = @["tests"] # so stupid... who doesn't want tests?
|
||||
#installFiles = @["balls.nim"] # https://github.com/nim-lang/Nim/issues/16661
|
||||
|
||||
task test, "run tests for ci":
|
||||
when defined(windows):
|
||||
exec "balls.cmd"
|
||||
else:
|
||||
exec "balls"
|
||||
|
||||
task demo, "produce a demo":
|
||||
exec "nim c --define:release balls.nim"
|
||||
when (NimMajor, NimMinor) != (1, 0):
|
||||
echo "due to nim bug #16307, use nim-1.0"
|
||||
quit 1
|
||||
exec """demo docs/demo.svg "nim c --out=\$1 examples/fails.nim""""
|
||||
exec """demo docs/clean.svg "nim c --define:danger -f --out=\$1 tests/test.nim""""
|
||||
exec "nim c --define:release --define:ballsDry balls.nim"
|
||||
exec """demo docs/runner.svg "balls""""
|
||||
|
||||
5
tools/atlas/tests/grok.nimble
Normal file
5
tools/atlas/tests/grok.nimble
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
version = "0.0.4"
|
||||
author = "disruptek"
|
||||
description = "don't read too much into it"
|
||||
license = "MIT"
|
||||
requires "nim >= 1.0.0"
|
||||
7
tools/atlas/tests/nim-bytes2human.nimble
Normal file
7
tools/atlas/tests/nim-bytes2human.nimble
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
version = "0.2.2"
|
||||
author = "Juan Carlos"
|
||||
description = "Convert bytes to kilobytes, megabytes, gigabytes, etc."
|
||||
license = "MIT"
|
||||
srcDir = "src"
|
||||
|
||||
requires "nim >= 1.0.0" # https://github.com/juancarlospaco/nim-bytes2human/issues/2#issue-714338524
|
||||
11
tools/atlas/tests/nim.cfg
Normal file
11
tools/atlas/tests/nim.cfg
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
############# begin Atlas config section ##########
|
||||
--noNimblePath
|
||||
--path:"../balls"
|
||||
--path:"../grok"
|
||||
--path:"../ups"
|
||||
--path:"../sync"
|
||||
--path:"../npeg/src"
|
||||
--path:"../testes"
|
||||
--path:"../grok"
|
||||
--path:"../nim-bytes2human/src"
|
||||
############# end Atlas config section ##########
|
||||
48
tools/atlas/tests/npeg.nimble
Normal file
48
tools/atlas/tests/npeg.nimble
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Package
|
||||
|
||||
version = "0.24.1"
|
||||
author = "Ico Doornekamp"
|
||||
description = "a PEG library"
|
||||
license = "MIT"
|
||||
srcDir = "src"
|
||||
installExt = @["nim"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 0.19.0"
|
||||
|
||||
# Test
|
||||
|
||||
task test, "Runs the test suite":
|
||||
exec "nimble testc && nimble testcpp && nimble testarc && nimble testjs"
|
||||
|
||||
task testc, "C tests":
|
||||
exec "nim c -r tests/tests.nim"
|
||||
|
||||
task testcpp, "CPP tests":
|
||||
exec "nim cpp -r tests/tests.nim"
|
||||
|
||||
task testjs, "JS tests":
|
||||
exec "nim js -r tests/tests.nim"
|
||||
|
||||
task testdanger, "Runs the test suite in danger mode":
|
||||
exec "nim c -d:danger -r tests/tests.nim"
|
||||
|
||||
task testwin, "Mingw tests":
|
||||
exec "nim c -d:mingw tests/tests.nim && wine tests/tests.exe"
|
||||
|
||||
task test32, "32 bit tests":
|
||||
exec "nim c --cpu:i386 --passC:-m32 --passL:-m32 tests/tests.nim && tests/tests"
|
||||
|
||||
task testall, "Test all":
|
||||
exec "nimble test && nimble testcpp && nimble testdanger && nimble testjs && nimble testwin"
|
||||
|
||||
when (NimMajor, NimMinor) >= (1, 1):
|
||||
task testarc, "--gc:arc tests":
|
||||
exec "nim c --gc:arc -r tests/tests.nim"
|
||||
else:
|
||||
task testarc, "--gc:arc tests":
|
||||
exec "true"
|
||||
|
||||
task perf, "Test performance":
|
||||
exec "nim cpp -r -d:danger tests/performance.nim"
|
||||
36
tools/atlas/tests/packages/packages.json
Normal file
36
tools/atlas/tests/packages/packages.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[
|
||||
{
|
||||
"name": "bytes2human",
|
||||
"url": "https://github.com/juancarlospaco/nim-bytes2human",
|
||||
"method": "git",
|
||||
"tags": [
|
||||
"bytes",
|
||||
"human",
|
||||
"minimalism",
|
||||
"size"
|
||||
],
|
||||
"description": "Convert bytes to kilobytes, megabytes, gigabytes, etc.",
|
||||
"license": "LGPLv3",
|
||||
"web": "https://github.com/juancarlospaco/nim-bytes2human"
|
||||
},
|
||||
{
|
||||
"name": "npeg",
|
||||
"url": "https://github.com/zevv/npeg",
|
||||
"method": "git",
|
||||
"tags": [
|
||||
"PEG",
|
||||
"parser",
|
||||
"parsing",
|
||||
"regexp",
|
||||
"regular",
|
||||
"grammar",
|
||||
"lexer",
|
||||
"lexing",
|
||||
"pattern",
|
||||
"matching"
|
||||
],
|
||||
"description": "PEG (Parsing Expression Grammars) string matching library for Nim",
|
||||
"license": "MIT",
|
||||
"web": "https://github.com/zevv/npeg"
|
||||
}
|
||||
]
|
||||
10
tools/atlas/tests/sync.nimble
Normal file
10
tools/atlas/tests/sync.nimble
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Package
|
||||
|
||||
version = "1.4.0"
|
||||
author = "Antonis Geralis"
|
||||
description = "Useful synchronization primitives."
|
||||
license = "MIT"
|
||||
|
||||
# Deps
|
||||
|
||||
requires "nim >= 1.0.0"
|
||||
23
tools/atlas/tests/testes.nimble
Normal file
23
tools/atlas/tests/testes.nimble
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
version = "1.0.0"
|
||||
author = "disruptek"
|
||||
description = "a cure for salty testes"
|
||||
license = "MIT"
|
||||
|
||||
#requires "cligen >= 0.9.41 & <= 0.9.45"
|
||||
#requires "bump >= 1.8.18 & < 2.0.0"
|
||||
requires "https://github.com/disruptek/grok >= 0.0.4 & < 1.0.0"
|
||||
requires "https://github.com/juancarlospaco/nim-bytes2human"
|
||||
|
||||
bin = @["testes"] # build the binary for basic test running
|
||||
installExt = @["nim"] # we need to install testes.nim also
|
||||
skipDirs = @["tests"] # so stupid... who doesn't want tests?
|
||||
|
||||
task test, "run tests for ci":
|
||||
exec "nim c --run testes.nim"
|
||||
|
||||
task demo, "produce a demo":
|
||||
when (NimMajor, NimMinor) != (1, 0):
|
||||
echo "due to nim bug #16307, use nim-1.0"
|
||||
quit 1
|
||||
exec """demo docs/demo.svg "nim c --out=\$1 examples/balls.nim""""
|
||||
exec """demo docs/clean.svg "nim c --define:danger --out=\$1 tests/testicles.nim""""
|
||||
13
tools/atlas/tests/ups.nimble
Normal file
13
tools/atlas/tests/ups.nimble
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
version = "0.0.2"
|
||||
author = "disruptek"
|
||||
description = "a package handler"
|
||||
license = "MIT"
|
||||
|
||||
requires "npeg >= 0.23.2 & < 1.0.0"
|
||||
requires "https://github.com/disruptek/testes >= 1.0.0 & < 2.0.0"
|
||||
|
||||
task test, "run tests":
|
||||
when defined(windows):
|
||||
exec "testes.cmd"
|
||||
else:
|
||||
exec findExe"testes"
|
||||
Loading…
Add table
Add a link
Reference in a new issue