{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/33954","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/33954/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/33954/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/33954/events","html_url":"https://github.com/rust-lang/rust/issues/33954","id":157412873,"number":33954,"title":"Test suite ignores tests after an exit(0).","user":{"login":"cristianoliveira","id":3959744,"avatar_url":"https://avatars.githubusercontent.com/u/3959744?v=3","gravatar_id":"","url":"https://api.github.com/users/cristianoliveira","html_url":"https://github.com/cristianoliveira","followers_url":"https://api.github.com/users/cristianoliveira/followers","following_url":"https://api.github.com/users/cristianoliveira/following{/other_user}","gists_url":"https://api.github.com/users/cristianoliveira/gists{/gist_id}","starred_url":"https://api.github.com/users/cristianoliveira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristianoliveira/subscriptions","organizations_url":"https://api.github.com/users/cristianoliveira/orgs","repos_url":"https://api.github.com/users/cristianoliveira/repos","events_url":"https://api.github.com/users/cristianoliveira/events{/privacy}","received_events_url":"https://api.github.com/users/cristianoliveira/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-29T23:57:09Z","updated_at":"2016-05-30T18:46:22Z","closed_at":"2016-05-30T18:46:22Z","body":"I was dealing with this issue (the tests that do not run) for while then I figured out that it was because of an exit(0) that was added in the middle of a method.\r\n\r\nThe problem occurs when there is some method that calls exit(0). The test suite starts to ignore fails for the next tests even for tests in others modules depending on the order of execution.\r\n\r\nExample of erroneous code:\r\n\r\n```rust\r\nuse std::process::exit;\r\n\r\nfn main() {\r\n    println!(\"Hello, world!\");\r\n}\r\n\r\nfn die() { // name is just an example\r\n    exit(0)\r\n}\r\n\r\n#[test]\r\nfn it_works() {\r\n    assert!(true);\r\n}\r\n\r\n#[test]\r\nfn it_does_not_run() {\r\n    assert!(false);\r\n}\r\n\r\n#[test]\r\n#[should_panic]\r\nfn it_dies() {\r\n    die();\r\n}\r\n\r\n// another file.\r\nmod other {\r\n    #[test]\r\n    fn it_may_run() {\r\n        assert!(false);\r\n    }\r\n}\r\n```\r\n\r\nI hoped that the `it_dies` test does not run and the others tests run without the influence of this problematic one.\r\n\r\nI got a strange behavior where the tests started to be ignored and the suite returning the total of all tests that supposed to be performed.\r\n\r\nI know that dealing with exit(0) on the tests may be difficult but I hope that the test suite: runs all the tests, shows some error/warning or an option to wait for it, like `#[should_exit]`.\r\n\r\nBtw, you are doing a great job guys!"}}
{"actor":{"display_login":"nagisa"}}