fluentasserts.core.operations.instanceOf 0/18(0%) line coverage

      
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
330
340
350
360
370
380
390
400
410
420
430
440
450
460
470
480
490
500
510
520
530
module fluentasserts.core.operations.instanceOf; import fluentasserts.core.results; import fluentasserts.core.evaluation; import fluentasserts.core.lifecycle; import std.conv; import std.datetime; import std.algorithm; version(unittest) { import fluentasserts.core.expect; } static immutable instanceOfDescription = "Asserts that the tested value is related to a type."; /// IResult[] instanceOf(ref Evaluation evaluation) @safe nothrow { string expectedType = evaluation.expectedValue.strValue[1 .. $-1]; string currentType = evaluation.currentValue.typeNames[0]; evaluation.message.addText(". "); auto existingTypes = findAmong(evaluation.currentValue.typeNames, [expectedType]); import std.stdio; auto isExpected = existingTypes.length > 0; if(evaluation.isNegated) { isExpected = !isExpected; } IResult[] results = []; if(!isExpected) { evaluation.message.addValue(evaluation.currentValue.strValue); evaluation.message.addText(" is instance of "); evaluation.message.addValue(currentType); evaluation.message.addText("."); } if(!isExpected && !evaluation.isNegated) { try results ~= new ExpectedActualResult("typeof " ~ expectedType, "typeof " ~ currentType); catch(Exception) {} } if(!isExpected && evaluation.isNegated) { try results ~= new ExpectedActualResult("not typeof " ~ expectedType, "typeof " ~ currentType); catch(Exception) {} } return results; }