Skip to content

Instantly share code, notes, and snippets.

View sergiught's full-sized avatar

Sergiu Ghitea sergiught

View GitHub Profile
@sergiught
sergiught / go-table-driven-tests-parallel.md
Created January 6, 2022 18:50 — forked from posener/go-table-driven-tests-parallel.md
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
<?xml version="1.0" encoding="UTF-8"?>
<cnchi>
<editions>
<edition name="common" description="Packages common to all DE and base">
<packages>
<pkgname>acpid</pkgname>
<pkgname>alsa-utils</pkgname>
<pkgname>antergos-keyring</pkgname>
<pkgname>antergos-mirrorlist</pkgname>
<pkgname>antergos-midnight-timers</pkgname>