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

      
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
1861
1961
200
2161
220
2361
240
250
260
2761
280
2961
3029
310
320
3361
340
3561
3626
3726
3826
3926
400
410
4287
4313
440
450
4687
4713
480
490
5061
510
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; } /// 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; }