1 module test_feature_tests; 2 3 debug (featureTest) { 4 import feature_test; 5 import std.typecons; 6 7 unittest { 8 FeatureTestRunner.instance.addBeforeAll(() { 9 FeatureTestRunner.instance.info("Runner Before All"); 10 }); 11 12 feature("Wrong is never right", (f) { 13 f.addBeforeAll(() { 14 f.info("Feature Before All"); 15 }); 16 f.scenario("Failing Scenario", { 17 "Wrong".shouldEqual("Right", "String value"); 18 }); 19 }, "english"); 20 21 feature("Ultimate answer", "According to the HGTTG", (f) { 22 f.scenario("What is the correct answer", { 23 f.info("Calculation ultimate answer, please wait 7.5 million years..."); 24 42.shouldEqual(42, "The ultimate answer"); 25 }); 26 f.scenario("Check the answer according to the scrabble tiles", { 27 f.info("Using Arthur Dent algorithm to produce scrabble tiles..."); 28 enum scrabbleTiles = 6*9; 29 scrabbleTiles.shouldEqual(42, "Scrabble tile answer"); 30 }); 31 }, "hgttg", "slow"); 32 33 feature("Ultimate question", "", (f) { 34 f.scenario("Calculate the _correct_ ultimate question", { 35 featureTestPending; 36 }); 37 }, "hgttg"); 38 39 feature("Null matchers", (f) { 40 f.scenario("null is null", { 41 null.shouldBeNull(); 42 }); 43 f.scenario("string is not null", { 44 "test".shouldNotBeNull(); 45 }); 46 f.scenario("Nullable support", { 47 Nullable!int hazy_int; 48 hazy_int.shouldBeNull(); 49 hazy_int = 2; 50 hazy_int.shouldNotBeNull(); 51 hazy_int.nullify(); 52 hazy_int.shouldBeNull(); 53 }); 54 }); 55 } 56 }