2017-09-24 64 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); 
} 

编译+运行有和没有单元测试将产生不同的结果。你的本地功能可以被调用,而不是真正的功能。