Skip to content

Commit

Permalink
Tests: Fix vfs paths on Windows
Browse files Browse the repository at this point in the history
With our versioned path implementation, we have the following issue:

assert(NativePath("/foo").absolute); // Passes
assert(NativePath(NativePath("/foo").toNativeString()).absolute); // Fails

However, instead of fixing the implementation, we provide
a different root for the VFS, which is arguably simpler but
also more correct.
  • Loading branch information
Geod24 committed Feb 15, 2024
1 parent 7df06ec commit 5dbdd3e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions source/dub/test/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,23 @@ public class TestDub : Dub
{
/// The virtual filesystem that this instance acts on
public FSEntry fs;
/// Convenience constants for use in unittets
public static immutable ProjectPath = NativePath("/dub/project/");

/// Convenience constants for use in unittests
version (Windows)
public static immutable Root = NativePath("T:\\dub\\");
else
public static immutable Root = NativePath("/dub/");

/// Ditto
public static immutable ProjectPath = Root ~ "project";

/// Ditto
public static immutable SpecialDirs Paths = {
temp: "/dub/temp/",
systemSettings: "/dub/system/",
userSettings: "/dub/user/",
userPackages: "/dub/user/",
cache: "/dub/user/cache/",
temp: Root ~ "temp/",
systemSettings: Root ~ "system/",
userSettings: Root ~ "user/",
userPackages: Root ~ "user/",
cache: Root ~ "user/" ~ "cache/",
};

/// Forward to base constructor
Expand Down

0 comments on commit 5dbdd3e

Please sign in to comment.