linkrope / dunit

xUnit Testing Framework for D
Boost Software License 1.0
37 stars 9 forks source link

Issus with getopt #9

Closed charleslaw closed 8 years ago

charleslaw commented 8 years ago

I am still new to Dlang, so it's possible this is user error. I am using:

$dmd -v
DMD64 D Compiler v2.065

I tried including dunit in a project I am building and I get these errors when I just have the dependency in dub.json & the import statement in my app.d:

Running dmd...
../../../.dub/packages/d-unit-0.7.2/src/dunit/framework.d(57): Error: undefined identifier GetoptResult
../../../.dub/packages/d-unit-0.7.2/src/dunit/framework.d(71): Error: undefined identifier GetOptException
../../../.dub/packages/d-unit-0.7.2/src/dunit/framework.d(73): Error: undefined identifier exception, did you mean class Exception?
../../../.dub/packages/d-unit-0.7.2/src/dunit/framework.d(81): Error: undefined identifier defaultGetoptPrinter

I believe the getopt interface has changed because I can build the following, which uses getopt pretty differently to how dunit uses it:

import std.getopt;

string data = "file.dat";
int length = 24;
bool verbose;

void main(string[] args)
{
  getopt(
    args,
    "length",  &length,    // numeric
    "file",    &data,      // string
    "verbose", &verbose   // flag
  );
}
charleslaw commented 8 years ago

Also slightly related: http://forum.dlang.org/thread/pyxmbhsrpjkvpnwisqjz@forum.dlang.org

linkrope commented 8 years ago

Consider updating your compiler: DMD 2.065 was released in February, 2014. For D programmers, that's ages ago. The latest release is 2.068.2. The green "passing" has been determined with 2.067.0, and the missing getopt behavior was introduced in this release. You need at least 2.067.0 to use v0.7.2 of dunit.