From 49db2a08ba78a5964067c5107d3de232c120daa4 Mon Sep 17 00:00:00 2001 From: genotrance Date: Fri, 29 Nov 2019 03:18:44 -0600 Subject: [PATCH] Fixes #12767 (#12768) --- compiler/options.nim | 2 ++ tests/nimble/tnimblepathdollar.nims | 2 +- tests/nimble/tnimblepathdollarfail.nim | 10 ++++++++++ tests/nimble/tnimblepathdollarfail.nims | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/nimble/tnimblepathdollarfail.nim create mode 100644 tests/nimble/tnimblepathdollarfail.nims diff --git a/compiler/options.nim b/compiler/options.nim index 5614030773..06f30ef99f 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -552,9 +552,11 @@ proc removeTrailingDirSep*(path: string): string = proc disableNimblePath*(conf: ConfigRef) = incl conf.globalOptions, optNoNimblePath conf.lazyPaths.setLen(0) + conf.nimblePaths.setLen(0) proc clearNimblePath*(conf: ConfigRef) = conf.lazyPaths.setLen(0) + conf.nimblePaths.setLen(0) include packagehandling diff --git a/tests/nimble/tnimblepathdollar.nims b/tests/nimble/tnimblepathdollar.nims index ff45366a8c..9621fb29fc 100644 --- a/tests/nimble/tnimblepathdollar.nims +++ b/tests/nimble/tnimblepathdollar.nims @@ -1,5 +1,5 @@ +switch("clearNimblePath") switch("nimblePath", "$projectdir/nimbleDir/simplePkgs") switch("path", "$nimblepath/pkgA-0.1.0") switch("path", "$nimblepath/pkgB-#head") switch("path", "$nimblepath/pkgC-#head") -switch("noNimblePath") diff --git a/tests/nimble/tnimblepathdollarfail.nim b/tests/nimble/tnimblepathdollarfail.nim new file mode 100644 index 0000000000..0b9b04eb43 --- /dev/null +++ b/tests/nimble/tnimblepathdollarfail.nim @@ -0,0 +1,10 @@ +discard """ + errmsg: "cannot open file: pkgA/module" +""" +import pkgA/module as A +import pkgB/module as B +import pkgC/module as C + +doAssert pkgATest() == 1, "Simple pkgA-0.1.0 wasn't added to path correctly." +doAssert pkgBTest() == 0xDEADBEEF, "pkgB-#head wasn't picked over pkgB-0.1.0" +doAssert pkgCTest() == 0xDEADBEEF, "pkgC-#head wasn't picked over pkgC-#aa11" diff --git a/tests/nimble/tnimblepathdollarfail.nims b/tests/nimble/tnimblepathdollarfail.nims new file mode 100644 index 0000000000..7d47da7440 --- /dev/null +++ b/tests/nimble/tnimblepathdollarfail.nims @@ -0,0 +1,5 @@ +switch("noNimblePath") +switch("nimblePath", "$projectdir/nimbleDir/simplePkgs") +switch("path", "$nimblepath/pkgA-0.1.0") +switch("path", "$nimblepath/pkgB-#head") +switch("path", "$nimblepath/pkgC-#head")