| 1 |
// REQUIRED_ARGS: -Jcompilable/imports/ |
| 2 |
// EXTRA_FILES: imports/imp16088.d imports/test21227/a..b.txt imports/test21227/a.txt imports/test21227/..foo/a.txt |
| 3 |
|
| 4 |
// https://issues.dlang.org/show_bug.cgi?id=16088 |
| 5 |
|
| 6 |
void bar(string x) {} |
| 7 |
auto foo() |
| 8 |
{ |
| 9 |
import("imp16088.d").bar; |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
// https://issues.dlang.org/show_bug.cgi?id=21227 |
| 14 |
|
| 15 |
void test21227() |
| 16 |
{ |
| 17 |
import("./test21227/a.txt").bar; |
| 18 |
import("test21227//a..b.txt").bar; |
| 19 |
import("test21227/..foo/a.txt").bar; |
| 20 |
|
| 21 |
version(Windows) |
| 22 |
{ |
| 23 |
import(r".\test21227\a.txt").bar; |
| 24 |
import(r"test21227\\a..b.txt").bar; |
| 25 |
import(r"test21227\..foo\a.txt").bar; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
// Test that it's treated like a hex string, allowing implicit conversion to byte array |
| 30 |
|
| 31 |
// Can't test whole contents because line endings may vary |
| 32 |
enum expectedStart = "module imports.imp16088;"; |
| 33 |
|
| 34 |
immutable ubyte[] s0 = import("imp16088.d"); |
| 35 |
|
| 36 |
static assert(s0[0 .. expectedStart.length] == "module imports.imp16088;"); |
| 37 |
|
| 38 |
// https://issues.dlang.org/show_bug.cgi?id=24687 |
| 39 |
|
| 40 |
void foo(string path); |
| 41 |
void foo(const(ubyte[]) data); |
| 42 |
|
| 43 |
void bar1() { foo(import("imp16088.d")); } // matches both |
| 44 |
void bar2() { foo(cast(const(ubyte[])) import("imp16088.d")); } // matches both! |