junegunn / junegunn/vader.vim

Proposal: Add BeforeFirst and AfterLast blocks

Open
#169 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Vim Script
Stars
599
Forks
40
PR merge metrics
No merged PRs in 30d

Description

I realised that for ALE, a lot of tests could run faster if some set up and tear down code only runs once for each file. After spending some time trying to think of names for blocks like that which are self-explanatory, I came up with `BeforeFirst` and `AfterLast`. These would be analogous to `setUpClass` and `tearDownClass` for Python unit test classes.

You could use both types of block together.

```vim
BeforeFirst:
let g:set_once = 3

AfterLast:
unlet! g:set_once

Before:
let g:set_before_every_test = 3

After:
unlet! g:set_before_every_test
```

You could use `AfterLast` to clean up data from a `Before` block, if you know you set up some data before every test, but only have to remove it after all of the tests have been run.

```vim
Before:
let g:set_before_every_test = 3

AfterLast:
unlet! g:set_before_every_test
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.