fluentasserts.core.operations.startWith 20/20(100%) line coverage

      
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
1785
180
1985
200
2185
2285
230
2485
2518
268
278
288
298
308
310
328
330
340
350
3667
379
389
399
409
419
420
439
440
450
460
470
4885
490
module fluentasserts.core.operations.startWith; import std.string; import fluentasserts.core.results; import fluentasserts.core.evaluation; import fluentasserts.core.serializers; import fluentasserts.core.lifecycle; version(unittest) { import fluentasserts.core.expect; } /// IResult[] startWith(ref Evaluation evaluation) @safe nothrow { Lifecycle.instance.addText("."); IResult[] results = []; auto index = evaluation.currentValue.strValue.cleanString.indexOf(evaluation.expectedValue.strValue.cleanString); auto doesStartWith = index == 0; if(evaluation.isNegated) { if(doesStartWith) { Lifecycle.instance.addText(" "); Lifecycle.instance.addValue(evaluation.currentValue.strValue); Lifecycle.instance.addText(" starts with "); Lifecycle.instance.addValue(evaluation.expectedValue.strValue); Lifecycle.instance.addText("."); try results ~= new ExpectedActualResult("to not start with " ~ evaluation.expectedValue.strValue, evaluation.currentValue.strValue); catch(Exception e) {} } } else { if(!doesStartWith) { Lifecycle.instance.addText(" "); Lifecycle.instance.addValue(evaluation.currentValue.strValue); Lifecycle.instance.addText(" does not start with "); Lifecycle.instance.addValue(evaluation.expectedValue.strValue); Lifecycle.instance.addText("."); try results ~= new ExpectedActualResult("to start with " ~ evaluation.expectedValue.strValue, evaluation.currentValue.strValue); catch(Exception e) {} } } return results; }