-
Notifications
You must be signed in to change notification settings - Fork 13.3k
move extra::test to libtest #12343
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
move extra::test to libtest #12343
Conversation
cc #8784. |
ast::ViewItemUse( | ||
~[@nospan(ast::ViewPathSimple(id_extra, | ||
path_node(~[id_extra]), | ||
~[@nospan(ast::ViewPathSimple(test_crate_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the problem here: it is making
mod __something {
use test;
// ... things using `test::foo()`
}
but libtest has no module test
. One fix would be to add a module to libtest/lib.rs
that reexports the relevant functions, e.g.
mod libtest_satisfy_the_test_runner {
pub use {test_main_static,
TestDescAndFn,
TestDesc, StaticTestName,
StaticTestFn, StaticBenchFn};
}
(Change the let test_crate_id = token::str_to_ident("test");
to "libtest_satisfy_the_test_runner"
.)
Hopefully someone has a better idea because that solution is really ugly. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why libstd has mod std
inside of it, I think this just means that libtest
needs to have mod test
inside of it (for the same hack-ish reasons)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huonw @alexcrichton Thank you, I'll try.
Stylistically instead of
I prefer
Could you update code examples and such to this? |
@alexcrichton I disagree: |
Ah I suppose so, I guess I was just a little rattled at all the |
@huonw @alexcrichton Why we name |
Let's not rename |
@@ -76,6 +77,7 @@ DEPS_getopts := std | |||
DEPS_collections := std serialize | |||
DEPS_fourcc := syntax std | |||
DEPS_num := std extra | |||
DEPS_test := std extra collections getopts serialize term | |||
|
|||
TOOL_DEPS_compiletest := extra green rustuv getopts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also looks like compiletest
should lose its extra
dependency and pick up its test
dependency.
I have updated this PR, all comments addressed. Ready to review and merge. |
ast::DUMMY_NODE_ID) | ||
}; | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be including chunks of commented out code, if it's no longer necessary it should be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think this logic needs to be preserved, this is the purpose of the 'mod test' in `libtest/lib.rs'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just let libtest
manage its own test scope, i.e. only insert extern crate test
when we're not in test, otherwise, if we are in test, do nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll restore the commented out code in rustc, and add mod test
to libtest, come back later. Though I don't know why we need do these special cases both in rustc and libtest. A simple extern crate test
(in the current commit) just make it works (all tests passed). @alexcrichton @huonw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you inject extern crate test
then you get this duality where libtest is being tested with another version of libtest. This causes all sorts of resolve pains when you want to start using one or the other. I think that it may be ok, but I would rather bootstrap libtest
with itself if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(It also leads to the weirdest error messages "expected test::Foo but found test::Foo".)
@huonw @alexcrichton I've updated this PR, added |
…richton I don't think `extra` is a good/meaningful name for a library. `libextra` should disappear, and we move all of its sub modules out of it. This PR is just one of that steps: move `extra::test` to `libtest`. I didn't add `libtest` to doc index, because it's an internal library currently. **Update:** All comments addressed. All tests passed. Rebased and squashed.
I don't think
extra
is a good/meaningful name for a library.libextra
should disappear, and we move all of its sub modules out of it. This PR is just one of that steps: moveextra::test
tolibtest
.I didn't add
libtest
to doc index, because it's an internal library currently.Update:
All comments addressed. All tests passed. Rebased and squashed.