Skip to content

testing: implement Cleanup(), with tests #2505

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

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

dkegel-fastly
Copy link
Contributor

t.Cleanup() will be needed when we implement t.TempDir().

Land it now with tests to reduce the size of the future pull request for t.TempDir().

Also update testdata/testing.go to run properly with go 1.16 (it crashed without this).
This was useful while I was debugging the tRunner() change.

Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there. Looking good!

@dkegel-fastly dkegel-fastly force-pushed the dkegel-testing-add-cleanup branch from 569b539 to 5700168 Compare January 11, 2022 01:03
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deadprogram
Copy link
Member

Please resolve merge conflict. Thanks.

No change in behavior, just preparing for next commit, and gently nudging code closer to upstream.
Also reorder and regroup common's fields slightly to match upstream.

TODO: pull in more upstream tests once this package is goroutine-safe
@dkegel-fastly dkegel-fastly force-pushed the dkegel-testing-add-cleanup branch from 5700168 to 5d5ad88 Compare January 11, 2022 16:23
@deadprogram
Copy link
Member

Thank you @dkegel-fastly now merging.

@deadprogram deadprogram merged commit ef77b64 into tinygo-org:dev Jan 12, 2022

// matchStringOnly is part of upstream, and is used below to provide a dummy deps to pass to MainStart
// so it can be run with go (tested with go 1.16) to provide a baseline for the regression test.
// See c56cc9b3b57276. Unfortunately, testdeps is internal, so we can't just use &testdeps.TestDeps{}.
Copy link
Member

@aykevl aykevl Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, testdeps is internal, so we can't just use &testdeps.TestDeps{}.

That's not the reason: the testing package can most certainly import internal packages because they're both part of GOROOT. The reason that testdeps exists is so that the testing package can import useful packages while those packages can still import the testing package (for their own tests) without creating a circular dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, nevermind. The comment is correct. I didn't realize the code was in testdata/testing.go (instead of src/testing.go).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants