Skip to content

Commit

Permalink
Use __FILE_FULL_PATH__ instead of __FILE__ in file IO tests
Browse files Browse the repository at this point in the history
This solves an issue where mach unit tests sometimes failed with no such file/directory errors
  • Loading branch information
pineapplemachine committed Feb 15, 2017
1 parent d6b30a3 commit 7b5df78
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mach/io/file/stat.d
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ version(unittest){
private:
import std.path;
import mach.test;
enum string TestPath = __FILE__.dirName ~ "/stat.txt";
enum string TestPath = __FILE_FULL_PATH__.dirName ~ "/stat.txt";
}
unittest{
tests("Stat", {
Expand Down
2 changes: 1 addition & 1 deletion mach/io/file/sys.d
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private version(unittest){
import std.path;
import mach.test;
import mach.error.mustthrow : mustthrow;
enum string CurrentPath = __FILE__.dirName;
enum string CurrentPath = __FILE_FULL_PATH__.dirName;
enum string TestPath = CurrentPath ~ "/sys.txt";
enum string FakePath1 = CurrentPath ~ "/nope_not_a_real_file";
enum string FakePath2 = CurrentPath ~ "/nope_not_a_real_file.txt";
Expand Down
2 changes: 1 addition & 1 deletion mach/io/file/traverse.d
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ version(unittest){
import std.path;
import mach.test;
import mach.range : filter, asarray;
enum string TestPath = __FILE__.dirName ~ "/traverse";
enum string TestPath = __FILE_FULL_PATH__.dirName ~ "/traverse";
struct Entry{
string path;
bool isdir = false;
Expand Down
2 changes: 1 addition & 1 deletion mach/io/stream/asarray.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ version(unittest){
import std.path;
import mach.test;
import mach.io.stream.filestream : FileStream;
enum string TestPath = __FILE__.dirName ~ "/range.txt";
enum string TestPath = __FILE_FULL_PATH__.dirName ~ "/range.txt";
}
unittest{
tests("Stream as array", {
Expand Down
2 changes: 1 addition & 1 deletion mach/io/stream/asrange.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ version(unittest){
import mach.test;
import mach.range : headis;
import mach.io.stream.filestream : FileStream;
enum string TestPath = __FILE__.dirName ~ "/range.txt";
enum string TestPath = __FILE_FULL_PATH__.dirName ~ "/range.txt";
}
unittest{
// TODO: Use an ArrayStream or something instead of a FileStream for tests
Expand Down
2 changes: 1 addition & 1 deletion mach/io/stream/filestream.d
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ version(unittest){
import mach.test;
import mach.io.stream.io;
import mach.io.stream.templates;
enum string TestPath = __FILE__.dirName ~ "/filestream.txt";
enum string TestPath = __FILE_FULL_PATH__.dirName ~ "/filestream.txt";
}
unittest{
tests("File stream", {
Expand Down

0 comments on commit 7b5df78

Please sign in to comment.