-
Notifications
You must be signed in to change notification settings - Fork 951
tinygo test command - step 1 #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This change is probably an AST-only change, in that most changes will be in the loader subpackage and not in the compiler. My understanding of
You may find more information in this package: You can do the change however you like, but incremental changes are much easier to review so what you describe (a WIP branch) sounds good. As for a MVP, I think being able to test the errors package would be a good starting point. It is probably the smallest package in the stdlib and doesn't depend on anything (in go1.11, it is being changed now). There is a possibility that the testing package does not yet compile, but you'll likely notice that soon enough. |
Thanks for the pointer to the loader, that is exactly what I was looking for! |
I would like to write tests for the various subpackages in https://github.com/tinygo-org/drivers To do that, I need a way to resolve the func TestBMP180Driver(t *testing.T) {
i2cTester := NewI2CTestInterface()
i2cTester.SetTxImpl = func(addr uint16, w, r []byte) error {
r[0] = bmp180.CHIP_ID
return nil
}
sensor := bmp180.New(i2cTester)
connected := sensor.Connected()
if !connected {
t.Fail()
}
} In the above func New(bus machine.I2C) Device {...} Any thoughts on this? Or is it too complex for this initial start to being able to run a |
I would start with a bare-bones When that is working, perhaps it is easiest to repurpose the existing dummy I2C implementation in the machine package as a testing system, or make it possible to override the existing no-op behavior with an actual implementation (which may be used for testing). The advantage is that it requires nothing special from the |
Now that the initial implementation of Thank you very much @carolynvs for all of your work on this so far! |
I would like to implement
tinygo test
. Not a full implementation ofgo test
but enough to get us started and build from there. My goal is to get enough working so that we can use it to test tinygo itself.tinygo test
would accept no arguments at first, local directory mode. (for example specifying a list of packages to test or a run filter, or verbose flag would come in later PRs).func TestXxx(*testing.T)
whereXxxx
starts with an uppercase letter.Would this be a welcome contribution?
My style is to submit WIP PRs, and get enough in that it's useful without trying to push through a monolithic PR that does everything. So if y'all are okay with this, I'd implement it, get it merged, and then work on improving it beyond what is outlined here (for example supporting more flags) in additional pull requests. Let me know if you have other preferences.
The text was updated successfully, but these errors were encountered: