1 import std.stdio; 2 import std.exception; 3 4 writeln( "Dash Config find unittest" ); 5 6 auto n1 = Node( [ "test1": 10 ] ); 7 8 assert( n1.find!int( "test1" ) == 10, "Config.find error." ); 9 10 assertThrown!YAMLException(n1.find!int( "dontexist" )); 11 12 // nested test 13 auto n2 = Node( ["test2": n1] ); 14 auto n3 = Node( ["test3": n2] ); 15 16 assert( n3.find!int( "test3.test2.test1" ) == 10, "Config.find nested test failed"); 17 18 auto n4 = Loader.fromString( cast(char[]) 19 "test3:\n" ~ 20 " test2:\n" ~ 21 " test1: 10" ).load; 22 assert( n4.find!int( "test3.test2.test1" ) == 10, "Config.find nested test failed");
Get the element, cast to the given type, at the given path, in the given node. *