mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-26 21:30:14 +03:00
Fix failing tester + add unittest for imports (#7)
This commit is contained in:
parent
5a9ed94d74
commit
d7623ebbb4
1 changed files with 34 additions and 0 deletions
|
@ -124,3 +124,37 @@ void printImports(bool usingStdin, string[] args, string[] importPaths, bool rec
|
|||
foreach (resolved; resolvedLocations[])
|
||||
writeln(resolved);
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
import std.stdio;
|
||||
import std.file;
|
||||
import core.stdc.stdio;
|
||||
|
||||
auto deleteme = "test.txt";
|
||||
File file = File(deleteme, "w");
|
||||
scope(exit)
|
||||
{
|
||||
assert(exists(deleteme));
|
||||
remove(deleteme);
|
||||
}
|
||||
|
||||
file.write(q{
|
||||
import std.stdio;
|
||||
import std.fish : scales, head;
|
||||
import DAGRON = std.experimental.dragon;
|
||||
import std.file;
|
||||
});
|
||||
|
||||
file.close();
|
||||
|
||||
auto importedFiles = new RedBlackTree!(string);
|
||||
visitFile(false, deleteme, importedFiles);
|
||||
|
||||
auto expected = new RedBlackTree!(string);
|
||||
expected.insert("std.stdio");
|
||||
expected.insert("std.fish");
|
||||
expected.insert("std.file");
|
||||
expected.insert("std.experimental.dragon");
|
||||
assert(expected == importedFiles);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue