Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Move root FSEntry from PackageManager to TestDub #2847

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/dub/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Dub {
* generally in a library setup, one may wish to provide a custom
* implementation, which can be done by overriding this method.
*/
protected PackageManager makePackageManager() const
protected PackageManager makePackageManager()
{
return new PackageManager(m_rootPath, m_dirs.userPackages, m_dirs.systemSettings, false);
}
Expand Down
12 changes: 8 additions & 4 deletions source/dub/test/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public void disableLogging()
*/
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/");
/// Ditto
Expand All @@ -158,6 +160,7 @@ public class TestDub : Dub
PackageSupplier[] extras = null,
SkipPackageSuppliers skip = SkipPackageSuppliers.none)
{
this.fs = new FSEntry();
super(root, extras, skip);
}

Expand All @@ -169,9 +172,10 @@ public class TestDub : Dub
}

///
protected override PackageManager makePackageManager() const
protected override PackageManager makePackageManager()
{
return new TestPackageManager();
assert(this.fs !is null);
return new TestPackageManager(this.fs);
}

/// See `MockPackageSupplier` documentation for this class' implementation
Expand Down Expand Up @@ -280,12 +284,12 @@ package class TestPackageManager : PackageManager
/// The virtual filesystem that this PackageManager acts on
protected FSEntry fs;

this()
this(FSEntry filesystem)
{
NativePath local = TestDub.ProjectPath;
NativePath user = TestDub.Paths.userSettings;
NativePath system = TestDub.Paths.systemSettings;
this.fs = new FSEntry();
this.fs = filesystem;
super(local, user, system, false);
}

Expand Down
Loading