Skip to content

Commit

Permalink
refactor: group the ParseSliceKey tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornplusplus committed Feb 15, 2024
1 parent be332e0 commit 1f8cedf
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions internal/setup/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,27 +1160,42 @@ var sliceKeyTests = []struct {
}, {
input: "fo_bar",
expected: setup.SliceKey{Package: "fo", Slice: "bar"},
}, {
input: "1234_bar",
expected: setup.SliceKey{Package: "1234", Slice: "bar"},
}, {
input: "foo1.1-2-3_bar",
expected: setup.SliceKey{Package: "foo1.1-2-3", Slice: "bar"},
}, {
input: "foo-pkg_dashed-slice-name",
expected: setup.SliceKey{Package: "foo-pkg", Slice: "dashed-slice-name"},
}, {
input: "foo+_bar",
expected: setup.SliceKey{Package: "foo+", Slice: "bar"},
}, {
input: "foo_slice123",
expected: setup.SliceKey{Package: "foo", Slice: "slice123"},
}, {
input: "g++_bins",
expected: setup.SliceKey{Package: "g++", Slice: "bins"},
}, {
input: "a+_bar",
expected: setup.SliceKey{Package: "a+", Slice: "bar"},
}, {
input: "a._bar",
expected: setup.SliceKey{Package: "a.", Slice: "bar"},
}, {
input: "foo_ba",
err: `invalid slice reference: "foo_ba"`,
}, {
input: "f_bar",
err: `invalid slice reference: "f_bar"`,
}, {
input: "1234_bar",
expected: setup.SliceKey{Package: "1234", Slice: "bar"},
}, {
input: "1234_789",
err: `invalid slice reference: "1234_789"`,
}, {
input: "foo1.1-2-3_bar",
expected: setup.SliceKey{Package: "foo1.1-2-3", Slice: "bar"},
}, {
input: "chicken_bar.b.q",
err: `invalid slice reference: "chicken_bar.b.q"`,
}, {
input: "foo-pkg_dashed-slice-name",
expected: setup.SliceKey{Package: "foo-pkg", Slice: "dashed-slice-name"},
}, {
input: "foo-_-bar",
err: `invalid slice reference: "foo-_-bar"`,
Expand All @@ -1193,33 +1208,18 @@ var sliceKeyTests = []struct {
}, {
input: "-foo_bar",
err: `invalid slice reference: "-foo_bar"`,
}, {
input: "foo+_bar",
expected: setup.SliceKey{Package: "foo+", Slice: "bar"},
}, {
input: "foo_slice123",
expected: setup.SliceKey{Package: "foo", Slice: "slice123"},
}, {
input: "foo_bar_baz",
err: `invalid slice reference: "foo_bar_baz"`,
}, {
input: "g++_bins",
expected: setup.SliceKey{Package: "g++", Slice: "bins"},
}, {
input: "a+_bar",
expected: setup.SliceKey{Package: "a+", Slice: "bar"},
}, {
input: "a-_bar",
err: `invalid slice reference: "a-_bar"`,
}, {
input: "a._bar",
expected: setup.SliceKey{Package: "a.", Slice: "bar"},
}, {
input: "+++_bar",
err: `invalid slice reference: .*`,
err: `invalid slice reference: "\+\+\+_bar"`,
}, {
input: "..._bar",
err: `invalid slice reference: .*`,
err: `invalid slice reference: "\.\.\._bar"`,
}, {
input: "white space_no-whitespace",
err: `invalid slice reference: "white space_no-whitespace"`,
Expand Down

0 comments on commit 1f8cedf

Please sign in to comment.