1 #!/usr/bin/env dub 2 /+ dub.sdl: 3 name "example" 4 dependency "d-unit" version=">=0.8.0" 5 dependency "unit-threaded" version=">=0.6.35" 6 +/ 7 8 // Copyright Mario Kröplin 2017. 9 // Distributed under the Boost Software License, Version 1.0. 10 // (See accompanying file LICENSE_1_0.txt or copy at 11 // http://www.boost.org/LICENSE_1_0.txt) 12 13 module fluent_assertion; 14 15 import dunit; 16 import unit_threaded.should; 17 18 /** 19 * This example demonstrates the reporting of test failures 20 * with unit-threaded's fluent assertions. 21 */ 22 class Test 23 { 24 mixin UnitTest; 25 26 @Test 27 public void shouldEqualFailure() @safe pure 28 { 29 "bar".shouldEqual("baz"); 30 } 31 32 @Test 33 public void shouldNotEqualFailure() @safe pure 34 { 35 "foo".shouldNotEqual("foo"); 36 } 37 38 @Test 39 public void shouldBeInFailure() @safe pure 40 { 41 42.shouldBeIn([0, 1, 2]); 42 } 43 } 44 45 // either use the 'Main' mixin or call 'dunit_main(args)' 46 mixin Main;