Skip to content

Commit

Permalink
test: ensure case names match function under test (google#228)
Browse files Browse the repository at this point in the history
Typically test functions should start with the function under test (or
at least that's the convention I've used for the rest of the tests in
`lockfile`).
  • Loading branch information
G-Rath authored and julieqiu committed May 2, 2023
1 parent 4c5b160 commit ddd7fce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions pkg/lockfile/apk-installed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/google/osv-scanner/pkg/lockfile"
)

func TestApkInstalled_FileDoesNotExist(t *testing.T) {
func TestParseApkInstalled_FileDoesNotExist(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/does-not-exist")
Expand All @@ -15,7 +15,7 @@ func TestApkInstalled_FileDoesNotExist(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestApkInstalled_Empty(t *testing.T) {
func TestParseApkInstalled_Empty(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/empty_installed")
Expand All @@ -27,7 +27,7 @@ func TestApkInstalled_Empty(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestApkInstalled_NotAnInstalled(t *testing.T) {
func TestParseApkInstalled_NotAnInstalled(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/not_installed")
Expand All @@ -39,7 +39,7 @@ func TestApkInstalled_NotAnInstalled(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestApkInstalled_Malformed(t *testing.T) {
func TestParseApkInstalled_Malformed(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/malformed_installed")
Expand All @@ -59,7 +59,7 @@ func TestApkInstalled_Malformed(t *testing.T) {
})
}

func TestApkInstalled_Single(t *testing.T) {
func TestParseApkInstalled_Single(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/single_installed")
Expand All @@ -79,7 +79,7 @@ func TestApkInstalled_Single(t *testing.T) {
})
}

func TestApkInstalled_Shuffled(t *testing.T) {
func TestParseApkInstalled_Shuffled(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/shuffled_installed")
Expand All @@ -99,7 +99,7 @@ func TestApkInstalled_Shuffled(t *testing.T) {
})
}

func TestApkInstalled_Multiple(t *testing.T) {
func TestParseApkInstalled_Multiple(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseApkInstalled("fixtures/apk/multiple_installed")
Expand Down
16 changes: 8 additions & 8 deletions pkg/lockfile/dpkg-status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/google/osv-scanner/pkg/lockfile"
)

func TestDpkgStatus_FileDoesNotExist(t *testing.T) {
func TestParseDpkgStatus_FileDoesNotExist(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/does-not-exist")
Expand All @@ -15,7 +15,7 @@ func TestDpkgStatus_FileDoesNotExist(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestDpkgStatus_Empty(t *testing.T) {
func TestParseDpkgStatus_Empty(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/empty_status")
Expand All @@ -27,7 +27,7 @@ func TestDpkgStatus_Empty(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestDpkgStatus_NotAStatus(t *testing.T) {
func TestParseDpkgStatus_NotAStatus(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/not_status")
Expand All @@ -39,7 +39,7 @@ func TestDpkgStatus_NotAStatus(t *testing.T) {
expectPackages(t, packages, []lockfile.PackageDetails{})
}

func TestDpkgStatus_Malformed(t *testing.T) {
func TestParseDpkgStatus_Malformed(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/malformed_status")
Expand All @@ -64,7 +64,7 @@ func TestDpkgStatus_Malformed(t *testing.T) {
})
}

func TestDpkgStatus_Single(t *testing.T) {
func TestParseDpkgStatus_Single(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/single_status")
Expand All @@ -83,7 +83,7 @@ func TestDpkgStatus_Single(t *testing.T) {
})
}

func TestDpkgStatus_Shuffled(t *testing.T) {
func TestParseDpkgStatus_Shuffled(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/shuffled_status")
Expand All @@ -102,7 +102,7 @@ func TestDpkgStatus_Shuffled(t *testing.T) {
})
}

func TestDpkgStatus_Multiple(t *testing.T) {
func TestParseDpkgStatus_Multiple(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/multiple_status")
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestDpkgStatus_Multiple(t *testing.T) {
})
}

func TestDpkgStatus_Source_Ver_Override(t *testing.T) {
func TestParseDpkgStatus_Source_Ver_Override(t *testing.T) {
t.Parallel()

packages, err := lockfile.ParseDpkgStatus("fixtures/dpkg/source_ver_override_status")
Expand Down

0 comments on commit ddd7fce

Please sign in to comment.