diff --git a/testament/azure.nim b/testament/azure.nim index af65d6a1c407..aba10b296134 100644 --- a/testament/azure.nim +++ b/testament/azure.nim @@ -6,7 +6,7 @@ # Look at license.txt for more info. # All rights reserved. -import base64, json, httpclient, os, strutils, uri +import std/[base64, json, httpclient, os, strutils, uri] import specs const diff --git a/testament/categories.nim b/testament/categories.nim index ee6177a20526..2e589591a918 100644 --- a/testament/categories.nim +++ b/testament/categories.nim @@ -12,9 +12,8 @@ # included from testament.nim -import important_packages import std/strformat -from std/sequtils import filterIt +import std/private/gitutils const specialCategories = [ @@ -223,12 +222,6 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) = template test(filename: untyped) = testSpec r, makeTest(filename, options, cat) - template testJS(filename: untyped) = - testSpec r, makeTest(filename, options, cat), {targetJS} - - template testCPP(filename: untyped) = - testSpec r, makeTest(filename, options, cat), {targetCpp} - let tests = [ "niminaction/Chapter1/various1", "niminaction/Chapter2/various2", @@ -247,8 +240,7 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) = "niminaction/Chapter6/WikipediaStats/parallel_counts", "niminaction/Chapter6/WikipediaStats/race_condition", "niminaction/Chapter6/WikipediaStats/sequential_counts", - "niminaction/Chapter6/WikipediaStats/unguarded_access", - "niminaction/Chapter8/sdl/sdl_test" + "niminaction/Chapter6/WikipediaStats/unguarded_access" ] when false: @@ -292,10 +284,6 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) = # Run the tests. for testfile in tests: test "tests/" & testfile & ".nim" - let jsFile = "tests/niminaction/Chapter8/canvas/canvas_test.nim" - testJS jsFile - let cppFile = "tests/niminaction/Chapter8/sfml/sfml_test.nim" - testCPP cppFile # ------------------------- manyloc ------------------------------------------- @@ -366,120 +354,15 @@ proc testStdlib(r: var TResults, pattern, options: string, cat: Category) = testObj.spec.action = actionCompile testSpec r, testObj -# ----------------------------- nimble ---------------------------------------- -proc listPackagesAll(): seq[NimblePackage] = - var nimbleDir = getEnv("NIMBLE_DIR") - if nimbleDir.len == 0: nimbleDir = getHomeDir() / ".nimble" - let packageIndex = nimbleDir / "packages_official.json" - let packageList = parseFile(packageIndex) - proc findPackage(name: string): JsonNode = - for a in packageList: - if a["name"].str == name: return a - for pkg in important_packages.packages.items: - var pkg = pkg - if pkg.url.len == 0: - let pkg2 = findPackage(pkg.name) - if pkg2 == nil: - raise newException(ValueError, "Cannot find package '$#'." % pkg.name) - pkg.url = pkg2["url"].str - result.add pkg - -proc listPackages(packageFilter: string): seq[NimblePackage] = - let pkgs = listPackagesAll() - if packageFilter.len != 0: - # xxx document `packageFilter`, seems like a bad API, - # at least should be a regex; a substring match makes no sense. - result = pkgs.filterIt(packageFilter in it.name) - else: - if testamentData0.batchArg == "allowed_failures": - result = pkgs.filterIt(it.allowFailure) - elif testamentData0.testamentNumBatch == 0: - result = pkgs - else: - let pkgs2 = pkgs.filterIt(not it.allowFailure) - for i in 0.. 0: myself &= " " & quoteShell("--targets:" & targetsStr) diff --git a/testament/testament.nim.cfg b/testament/testament.nim.cfg index c97284129ea7..b32e6bf99be0 100644 --- a/testament/testament.nim.cfg +++ b/testament/testament.nim.cfg @@ -1,6 +1,6 @@ # don't move this file without updating the logic in `isNimRepoTests` -path = "$nim" # For compiler/nodejs +path = "$nim;." # For compiler/nodejs -d:ssl # For azure # my SSL doesn't have this feature and I don't care: -d:nimDisableCertificateValidation diff --git a/tests/cpp/tasync_cpp.nim b/tests/cpp/tasync_cpp.nim index 696274ec4763..74f6a36b4157 100644 --- a/tests/cpp/tasync_cpp.nim +++ b/tests/cpp/tasync_cpp.nim @@ -6,7 +6,7 @@ discard """ # bug #3299 -import jester +# import jester # xxx: why the hell are we doing crap like this? import asyncdispatch, asyncnet # bug #5081 diff --git a/tests/niminaction/Chapter8/canvas/canvas.nim b/tests/niminaction/Chapter8/canvas/canvas.nim deleted file mode 100644 index ae2765630dfd..000000000000 --- a/tests/niminaction/Chapter8/canvas/canvas.nim +++ /dev/null @@ -1,23 +0,0 @@ -discard """ -action: compile -""" - -import dom - -type - CanvasRenderingContext* = ref object - fillStyle* {.importc.}: cstring - strokeStyle* {.importc.}: cstring - -{.push importcpp.} - -proc getContext*(canvasElement: Element, - contextType: cstring): CanvasRenderingContext - -proc fillRect*(context: CanvasRenderingContext, x, y, width, height: int) - -proc moveTo*(context: CanvasRenderingContext, x, y: int) - -proc lineTo*(context: CanvasRenderingContext, x, y: int) - -proc stroke*(context: CanvasRenderingContext) diff --git a/tests/niminaction/Chapter8/canvas/canvas_test.nim b/tests/niminaction/Chapter8/canvas/canvas_test.nim deleted file mode 100644 index 42d222b7b75e..000000000000 --- a/tests/niminaction/Chapter8/canvas/canvas_test.nim +++ /dev/null @@ -1,19 +0,0 @@ -import canvas, dom - -proc onLoad() {.exportc.} = - var canvas = document.getElementById("canvas").EmbedElement - canvas.width = window.innerWidth - canvas.height = window.innerHeight - var ctx = canvas.getContext("2d") - - ctx.fillStyle = "#1d4099" - ctx.fillRect(0, 0, window.innerWidth, window.innerHeight) - - ctx.strokeStyle = "#ffffff" - let letterWidth = 100 - let letterLeftPos = (window.innerWidth div 2) - (letterWidth div 2) - ctx.moveTo(letterLeftPos, 320) - ctx.lineTo(letterLeftPos, 110) - ctx.lineTo(letterLeftPos + letterWidth, 320) - ctx.lineTo(letterLeftPos + letterWidth, 110) - ctx.stroke() diff --git a/tests/niminaction/Chapter8/sdl/sdl.nim b/tests/niminaction/Chapter8/sdl/sdl.nim deleted file mode 100644 index 212f7b02282b..000000000000 --- a/tests/niminaction/Chapter8/sdl/sdl.nim +++ /dev/null @@ -1,38 +0,0 @@ -when defined(windows): - const libName* = "SDL2.dll" -elif defined(linux) or defined(freebsd) or defined(netbsd): - const libName* = "libSDL2.so" -elif defined(macosx): - const libName* = "libSDL2.dylib" -elif defined(openbsd): - const libName* = "libSDL2.so.0.6" -else: - {.error: "SDL library name not set for this platform".} - -type - SdlWindow = object - SdlWindowPtr* = ptr SdlWindow - SdlRenderer = object - SdlRendererPtr* = ptr SdlRenderer - -const INIT_VIDEO* = 0x00000020 - -{.push dynlib: libName.} -proc init*(flags: uint32): cint {.importc: "SDL_Init".} - -proc createWindowAndRenderer*(width, height: cint, window_flags: cuint, - window: var SdlWindowPtr, renderer: var SdlRendererPtr): cint - {.importc: "SDL_CreateWindowAndRenderer".} - -proc pollEvent*(event: pointer): cint {.importc: "SDL_PollEvent".} - -proc setDrawColor*(renderer: SdlRendererPtr, r, g, b, a: uint8): cint - {.importc: "SDL_SetRenderDrawColor", discardable.} - -proc present*(renderer: SdlRendererPtr) {.importc: "SDL_RenderPresent".} - -proc clear*(renderer: SdlRendererPtr) {.importc: "SDL_RenderClear".} - -proc drawLines*(renderer: SdlRendererPtr, points: ptr tuple[x, y: cint], - count: cint): cint {.importc: "SDL_RenderDrawLines", discardable.} -{.pop.} diff --git a/tests/niminaction/Chapter8/sdl/sdl_test.nim b/tests/niminaction/Chapter8/sdl/sdl_test.nim deleted file mode 100644 index 1c4d258fb37e..000000000000 --- a/tests/niminaction/Chapter8/sdl/sdl_test.nim +++ /dev/null @@ -1,41 +0,0 @@ -discard """ -action: compile -""" - -import os -import sdl - -if sdl.init(INIT_VIDEO) == -1: - quit("Couldn't initialise SDL") - -var window: SdlWindowPtr -var renderer: SdlRendererPtr -if createWindowAndRenderer(640, 480, 0, window, renderer) == -1: - quit("Couldn't create a window or renderer") - -discard pollEvent(nil) -renderer.setDrawColor 29, 64, 153, 255 -renderer.clear -renderer.setDrawColor 255, 255, 255, 255 - -when defined(c): - # just to ensure code from NimInAction still works, but - # the `else` branch would work as well in C mode - var points = [ - (260'i32, 320'i32), - (260'i32, 110'i32), - (360'i32, 320'i32), - (360'i32, 110'i32) - ] -else: - var points = [ - (260.cint, 320.cint), - (260.cint, 110.cint), - (360.cint, 320.cint), - (360.cint, 110.cint) - ] - -renderer.drawLines(addr points[0], points.len.cint) - -renderer.present -sleep(5000) diff --git a/tests/niminaction/Chapter8/sfml/sfml.nim b/tests/niminaction/Chapter8/sfml/sfml.nim deleted file mode 100644 index fea85fcd4f58..000000000000 --- a/tests/niminaction/Chapter8/sfml/sfml.nim +++ /dev/null @@ -1,26 +0,0 @@ -{.passL: "-lsfml-graphics -lsfml-system -lsfml-window".} - -type - VideoMode* {.importcpp: "sf::VideoMode".} = object - RenderWindowObj {.importcpp: "sf::RenderWindow".} = object - RenderWindow* = ptr RenderWindowObj - Color* {.importcpp: "sf::Color".} = object - Event* {.importcpp: "sf::Event".} = object - -{.push cdecl, header: "".} - -proc videoMode*(modeWidth, modeHeight: cuint, modeBitsPerPixel: cuint = 32): VideoMode - {.importcpp: "sf::VideoMode(@)", constructor.} - -proc newRenderWindow*(mode: VideoMode, title: cstring): RenderWindow - {.importcpp: "new sf::RenderWindow(@)", constructor.} - -proc pollEvent*(window: RenderWindow, event: var Event): bool - {.importcpp: "#.pollEvent(@)".} - -proc newColor*(red, green, blue, alpha: uint8): Color - {.importcpp: "sf::Color(@)", constructor.} - -proc clear*(window: RenderWindow, color: Color) {.importcpp: "#.clear(@)".} - -proc display*(window: RenderWindow) {.importcpp: "#.display()".} diff --git a/tests/niminaction/Chapter8/sfml/sfml_test.nim b/tests/niminaction/Chapter8/sfml/sfml_test.nim deleted file mode 100644 index e71060cb43c8..000000000000 --- a/tests/niminaction/Chapter8/sfml/sfml_test.nim +++ /dev/null @@ -1,14 +0,0 @@ -discard """ -action: compile -disabled: "windows" -""" - -import sfml, os -var window = newRenderWindow(videoMode(800, 600), "SFML works!") - -var event: Event -discard window.pollEvent(event) -window.clear(newColor(29, 64, 153, 255)) -window.display() - -sleep(1000)