Closed neildavis closed 1 year ago
In case you wonder "Why?" - my motivation for this stems from fixing #422 and adding support for #421. Whilst the devices are GPIO based (requiring importing machine
package) there are some protocol packet assembly/disassembly logic functions indpendent of that, which I'd like to include unit tests for.
Currently this isn't possible if the tests are included in the same package (irremote
in my case) as any code that imports machine
, even in separate .go
files. So I decided to split the protocol specifics out into a separate package. The choices then are:
irprotocol
as a sibling of irremote
(and all other drivers)irremote/irprotocol
I think the second option is preferable from an organization viewpoint. This necessitates the change to Makefile
to allow testing of irremote/irprotocol
whilst excluding irremote
Closing since merged in v0.22.0
Currently
Makefile
assumes all dirs (drivers or not) either have unit tests, or will at least run undergo test
A manual list ($(NOTESTS)
) variable is used to exclude anything problematic (usually code that importsmachine
which doesn't compile under 'vanilla go' used for runninggo test
)This is rather inflexible and has a few problems:
parent/child
wherechild
may have unit tests.make unit-test
contains many superfluous lines like:? tinygo.org/x/drivers/adxl345 [no test files]
where the package doesn't have any tests but doesn't fail either.I propose an improvement to recursively identify which dirs contain files with names matching
*_test.go
and only rungo test
on those dirs. A manual exclusion list can be retained for convenience.I've submitted #427 as a candidate to resolve this.