Fork me on GitHub
#conjure
<
2021-06-04
>
emilaasa09:06:59

I found a nifty thing that I hadn't thought of before, using gq to reformat a hard to read test diff in the REPL output buffer:

👀 4
💯 2
GitHub10:06:47

[Olical/conjure] Issue opened by Olical

Sigve11:06:17

Does anyone have tips for jumping to the location of failed tests? My idea would be to somehow load the filename and line number into the quickfix-list, but not sure on how to access the output buffer to do it

Sigve14:06:08

If anyone is interested, here is my quick hack for loading the errors into the quickfix list

exe bufwinnr('conjure-log-') . "wincmd w"
    let l:lines = getline(search("^; Testing ", 'bn'), '$')
    let l:lines_fail   = filter(deepcopy(l:lines), { key, val -> val =~ '^; FAIL in' })
    let l:lines_expect = filter(deepcopy(l:lines), { key, val -> val =~ '^; expected:' })
    let l:lines_actual = filter(deepcopy(l:lines), { key, val -> val =~ '^;   actual:' })
    let l:lines_fail   = map(l:lines_fail, { key, val-> join(split(split(split(split(val)[4], "(")[0], ")")[0], ":")[0:2], ":") })
    let l:lines_expect = map(l:lines_expect, { key, val-> split(val, "; ")[0]})
    let l:lines_actual = map(l:lines_actual, { key, val-> split(val, ";   ")[0]})
    let l:lines_join   = map(l:lines_fail, { key, val-> val . ":" . l:lines_expect[key] . " " . l:lines_actual[key]})
    cgetexpr l:lines_join
    wincmd p
    copen
please dont shoot me, vimscript is hard