What is the meaning of rectangle areas with stripe

2020-02-28 03:54发布

问题:

Xcode 9.2. I have enabled test coverage, written some tests and run them.

On the right side of the editor, Xcode shows if a code has been tested or not by displaying red or green rectangles.

However, I don't know what is the meaning of a rectangle with stripes.

I have not managed to find an answer in Xcode guides or help files.

Screenshot:

回答1:

The striped rectangles indicate partial code coverage. Somebody just asked this question elsewhere and in looking at some test cases, I realized that if you hover your mouse over a line with the stripes, you get something like this:

As you'll notice, part of the line is green and part of it is red. The green part is for the condition which comes under code coverage since that part was executed. The red part is for the error message which was not executed since the test passed. Hope that makes sense?