http://d.puremagic.com/issues/show_bug.cgi?id=2749
Summary: Make unittests named and nestable Product: D Version: 1.041 Platform: All URL: http://www.digitalmars.com/d/archives/digitalmars/D/Impr oving_unit_tests_79469.html OS/Version: All Status: NEW Keywords: diagnostic, spec Severity: enhancement Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: g...@nwawudu.com The current unit tests lack some functionality. - The current unit tests are not named. - There is no output that specifically indicates that the tests were run. - A single failing test will prevent all other tests from running. - There is no indication of which test failed. - There is no way to only run a subset of tests. Changing the language to allow nested and named unittest would help. The nesting would allow for the only the tests within the scope to fail and subsequent tests would run. The naming could be used to provide output and to select which tests are run. Example of unittest =================== unittest ("XML") { unittest("elements") { assert(isValidXml("<aaa />")); assert(isValidXml("<aaa/>")); assert(isValidXml("<aaa></aaa>")); ... unittest("case unmatched") assert(!isValidXml("<AaA></aaa>")); unittest("no closing") assert(!isValidXml("<aaa>")); ... } unittest("attributes") { assert(isValidXml("<aaa abc='x'/>")); assert(isValidXml("<aaa abc="\x\"/>")); assert(isValidXml("<aaa abc=\"x\" def=\"y\"/>")); ... unittest("unquoted") assert(!isValidXml("<aaa abc=x />")); unittest("multi attr") assert(!isValidXml("<aaa abc='x' abc='y'/>")); ... } unittest("encoding") { assert(encode("hello") is "hello"); assert(encode("a > b") == "a > b"); ... } } --