panvimdoc icon indicating copy to clipboard operation
panvimdoc copied to clipboard

fix: title tests

Open backdround opened this issue 2 years ago • 1 comments
trafficstars

I tried to write tests for #60, but figured out that title tests don't work at all because remove_first_line removes the actual title line to test.

I can prove it without manual testing: The occupied space by a month and a day in CURRENT_DATE changes every month (/day), and the count of spaces for padding in the title should change too from time to time. If it worked as expected, it would fail, at least in some short months (June / July).

Here I use Regex to work around this problem.

I didn't sort out how I can add more information "why the test has failed", so I did it by @error

There is how it looks like: image

I hope there is another way to give a fail context

backdround avatar Nov 17 '23 23:11 backdround

Ah, okay don't worry about it! I'll look into this and add a test for it when I get the chance, and update this PR.

I merged your other PR! Thanks for that PR and for adding tests in this PR.

kdheepak avatar Nov 18 '23 16:11 kdheepak