make nimble packages testing more robust (#10984)

* better tests for the existing packages
* enable testing for packages not in packages.json
* add new packages
This commit is contained in:
Miran 2019-04-09 19:38:50 +02:00 • committed by Andreas Rumpf
commit a4883b8426
2 changed files with 79 additions and 44 deletions

View file

@ -470,18 +470,25 @@ proc getPackageDir(package: string): string =
iterator listPackages(): tuple[name, url, cmd: string, hasDeps: bool] =
let defaultCmd = "nimble test"
let packageList = parseFile(packageIndex)
for n, cmd, commit, hasDeps in important_packages.packages.items:
var found = false
for package in packageList.items:
let name = package["name"].str
if name == n:
found = true
let url = package["url"].str
let cmd = if cmd.len == 0: defaultCmd else: cmd
yield (name, url, cmd, hasDeps)
break
if not found:
raise newException(ValueError, "Cannot find package '$#'." % n)
for n, cmd, hasDeps, url in important_packages.packages.items:
let cmd = if cmd.len == 0: defaultCmd else: cmd
if url.len != 0:
if hasDeps:
# use url instead of name, so we can do 'nimble install'
yield (url, url, cmd, hasDeps)
else:
yield (n, url, cmd, hasDeps)
else:
var found = false
for package in packageList.items:
let name = package["name"].str
if name == n:
found = true
let p_url = package["url"].str
yield (name, p_url, cmd, hasDeps)
break
if not found:
raise newException(ValueError, "Cannot find package '$#'." % n)
proc makeSupTest(test, options: string, cat: Category): TTest =
result.cat = cat