Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/env-macro/option_env-not-defined.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

6 lines
98 B
Rust
Raw Normal View History

tests: Add missing run-pass annotations
2019-07-27 00:54:25 +03:00
//@ run-pass
Fix run-pass tests to have 'pub fn main' This is required by the check-fast target because each test is slurped up into a submodule.
2013-09-25 00:43:37 -07:00
pub fn main() {
Fixed option_env! type The type of the result of option_env! was not fully specified in the None case, leading to type check failures in the case where the variable was not defined (e.g. option_env!("FOO").is_none()).
2013-08-10 11:09:30 -07:00
assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none());
env! syntax extension changes env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Close #2248
2013-08-07 00:50:23 -04:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 3665ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API