VS Code snippets for failing test output

Target group: people using VS Code and who often prefer to use standard library testing package (as opposed to https://github.com/stretchr/testify for example)

What? I propose two snippets for friendly failing test output. VS Code now requires 10 upvotes before snippet PR are accepted, so please upvote when you would find it useful.

How it works? You would type in gwf (usually gw would be sufficient) and click tab to get the following interactive snippet added to your code.
t.Fatalf("1(2) = 3, want 4", 5)

Text cursor will be put to where the number 1 is, where you can type in the function name you are testing. After typing in the function name, clicking tab would move you to type in arguments on place 2, and so on until you have filled in all 5 slots.

Example result:
t.Fatalf("sum(%d, %d) = %d, want %d", a, b, got, want)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.