Skip to content

more usage info for newbies? #21

@biocyberman

Description

@biocyberman

I ran the example.d, the output style of tests are something I would like to use for my code. However, reading example.d content, it is not clear to me what is the real code and what is the test code. And more practically, how do I migrate from the code using D built-in unittest to dunit.

For example, consider myDbuiltinTest.d:

import std.string: toLower;

string strToLower(string s){
  string ret;
  foreach(c; s) ret ~= toLower(c);
  return ret;
}

unittest{
  writeln("Test strToLower);
  assert("lower" == strToLower("LoWer"));
}
unittest{
  writeln("Test strToLower with unicode);
  assert(" lower2 ü" == strToLower(" LoWer2 Å"));
}

My questions:

  1. How do I make use of dunit in this case?
  2. And in case I want to run a particular test because hundreds of other tests have just been run, how do I do that?
  3. Finally when I want to run test for the whole project with multiple files, do I have to walk through all .d files and execute them individually?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions