rejeep / ert-runner.el

Opinionated Ert testing workflow
85 stars 19 forks source link

Check in batch script if variable is defined #53

Closed hatheroldev closed 4 years ago

hatheroldev commented 4 years ago

This pull-request fixes issue #52.

rejeep commented 4 years ago

I don't run Windows and don't know the language, can you please explain why this solves the problem (and hopefully not break something else)?

hatheroldev commented 4 years ago

The old code tried to check, whether the variable inside_emacs is set. To do so it compared [] with the expansion [%inside_emacs%].

Now is seems that, compared to older emacs versions, the content of inside_emacs changed and now contains a comma. In my case this is 27.0.50,compile. That comma has some meaning to the parser. The test expression becomes not [27.0.50 followed by compile]==[], which does not make sense for the parser at this point.

Since we do not care about the actual content of inside_emacs we can use the test expression not defined inside_emacs, which explicitly tests for the variable being set. A bonus advantage is that this documents the intended test, compared to the former cryptic test.

You can read more about the syntax here or here.

rejeep commented 4 years ago

Thanks for the explanation. I added you as a collaborator, feel free to merge.