diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-09-03 02:16:10 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-09-03 02:16:10 +0900 |
| commit | 024d2ff7826a81db65eefa1843730b537ebdeef1 (patch) | |
| tree | b3d9048c075fec0759bd8886a07a252ca0ce4555 /system/output_test.go | |
| parent | 6f719bc3c19d56279d2d76d3bcf8fb66ace2d2fb (diff) | |
system: improve tests of the I struct
This cleans up for the test overhaul of this package.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/output_test.go')
| -rw-r--r-- | system/output_test.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/system/output_test.go b/system/output_test.go index 9ad949c3..2dfa337d 100644 --- a/system/output_test.go +++ b/system/output_test.go @@ -209,18 +209,22 @@ func (ptc tcOp) test(t *testing.T, gotOps []Op, wantOps []Op, fn string) { t.Run("criteria", func(t *testing.T) { testCases := []struct { name string - ec *Criteria + ec Enablement want bool }{ - {"nil", nil, ptc.et != User}, - {"self", newCriteria(ptc.et), true}, - {"all", newCriteria(EWayland | EX11 | EDBus | EPulse | User | Process), true}, - {"enablements", newCriteria(EWayland | EX11 | EDBus | EPulse), ptc.et != User && ptc.et != Process}, + {"nil", 0xff, ptc.et != User}, + {"self", ptc.et, true}, + {"all", EWayland | EX11 | EDBus | EPulse | User | Process, true}, + {"enablements", EWayland | EX11 | EDBus | EPulse, ptc.et != User && ptc.et != Process}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - if got := tc.ec.hasType(o); got != tc.want { + var criteria *Criteria + if tc.ec != 0xff { + criteria = (*Criteria)(&tc.ec) + } + if got := criteria.hasType(o.Type()); got != tc.want { t.Errorf("hasType: got %v, want %v", got, tc.want) } @@ -229,5 +233,3 @@ func (ptc tcOp) test(t *testing.T, gotOps []Op, wantOps []Op, fn string) { }) } } - -func newCriteria(e Enablement) *Criteria { return (*Criteria)(&e) } |
