From 80cd52f2fa2ba4528e3a90f02754392787e860a2 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 4 Mar 2023 13:08:47 +1300 Subject: [PATCH] test: remove nonsense case and correct names (#176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Gemfile.lock` is nothing close to JSON, so this test doesn't make sense - removing it does not decrease coverage either, so lets axe it. My best guess is that it came from copying the standard set of tests from one of the other parsers, and then not realising it since it never failed 🤷 I also noticed two test cases were incorrectly named "json" instead of "toml", so have corrected that too --- pkg/lockfile/parse-cargo-lock_test.go | 2 +- pkg/lockfile/parse-gemfile-lock_test.go | 12 ------------ pkg/lockfile/parse-poetry-lock_test.go | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/pkg/lockfile/parse-cargo-lock_test.go b/pkg/lockfile/parse-cargo-lock_test.go index 51eee3a1..e9f8561b 100644 --- a/pkg/lockfile/parse-cargo-lock_test.go +++ b/pkg/lockfile/parse-cargo-lock_test.go @@ -14,7 +14,7 @@ func TestParseCargoLock_FileDoesNotExist(t *testing.T) { expectPackages(t, packages, []lockfile.PackageDetails{}) } -func TestParseCargoLock_InvalidJson(t *testing.T) { +func TestParseCargoLock_InvalidToml(t *testing.T) { t.Parallel() packages, err := lockfile.ParseCargoLock("fixtures/cargo/not-toml.txt") diff --git a/pkg/lockfile/parse-gemfile-lock_test.go b/pkg/lockfile/parse-gemfile-lock_test.go index 40fb828a..8585436e 100644 --- a/pkg/lockfile/parse-gemfile-lock_test.go +++ b/pkg/lockfile/parse-gemfile-lock_test.go @@ -14,18 +14,6 @@ func TestParseGemfileLock_FileDoesNotExist(t *testing.T) { expectPackages(t, packages, []lockfile.PackageDetails{}) } -func TestParseGemfileLock_InvalidJson(t *testing.T) { - t.Parallel() - - packages, err := lockfile.ParseGemfileLock("fixtures/bundler/not-json.txt") - - if err == nil { - t.Errorf("Expected to get error, but did not") - } - - expectPackages(t, packages, []lockfile.PackageDetails{}) -} - func TestParseGemfileLock_NoSpecSection(t *testing.T) { t.Parallel() diff --git a/pkg/lockfile/parse-poetry-lock_test.go b/pkg/lockfile/parse-poetry-lock_test.go index 78725951..52a4f312 100644 --- a/pkg/lockfile/parse-poetry-lock_test.go +++ b/pkg/lockfile/parse-poetry-lock_test.go @@ -14,7 +14,7 @@ func TestParsePoetryLock_FileDoesNotExist(t *testing.T) { expectPackages(t, packages, []lockfile.PackageDetails{}) } -func TestParsePoetryLock_InvalidJson(t *testing.T) { +func TestParsePoetryLock_InvalidToml(t *testing.T) { t.Parallel() packages, err := lockfile.ParsePoetryLock("fixtures/poetry/not-toml.txt")