2017-09-24 53 views

回答

4
writeln("hey ioctl, your mother is a hamster and your father smells of elderberries!"); 

我只是在開玩笑。

我會做的是prolly寫一個假的ioctl函數,看起來相同,並使用進口和版本,以誘騙:

import core.sys.posix.sys.ioctl; 

version(unittest) 
int ioctl(int d, int request, ...) { 
     import std.stdio; 
     writeln("its a fake!"); 
     return 0; 
} 

void main() { 
     ioctl(0, 0); 
} 

編譯+運行有和沒有單元測試將產生不同的結果。你的本地功能可以被調用,而不是真正的功能。