diff options
author | Aleksey Kladov <[email protected]> | 2021-06-15 20:59:51 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-15 20:59:51 +0100 |
commit | 2870d2bade94ae276cba56caf8c35feaacd49422 (patch) | |
tree | 4f2e0f2f070d44d408d24a087d9fb9d06d499b6d /crates/test_utils/src | |
parent | 3efe5c3426a311b6d617f9718b82e9a598dfa06d (diff) |
internal: add option to minicore
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/fixture.rs | 2 | ||||
-rw-r--r-- | crates/test_utils/src/minicore.rs | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 779146084..6ba112de8 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs | |||
@@ -198,6 +198,7 @@ impl MiniCore { | |||
198 | self.activated_flags.iter().any(|it| it == flag) | 198 | self.activated_flags.iter().any(|it| it == flag) |
199 | } | 199 | } |
200 | 200 | ||
201 | #[track_caller] | ||
201 | fn assert_valid_flag(&self, flag: &str) { | 202 | fn assert_valid_flag(&self, flag: &str) { |
202 | if !self.valid_flags.iter().any(|it| it == flag) { | 203 | if !self.valid_flags.iter().any(|it| it == flag) { |
203 | panic!("invalid flag: {:?}, valid flags: {:?}", flag, self.valid_flags); | 204 | panic!("invalid flag: {:?}, valid flags: {:?}", flag, self.valid_flags); |
@@ -299,6 +300,7 @@ impl MiniCore { | |||
299 | let skip = if flag == "" { | 300 | let skip = if flag == "" { |
300 | false | 301 | false |
301 | } else { | 302 | } else { |
303 | assert!(!flag.starts_with(' '), "region marker starts with a space: {:?}", flag); | ||
302 | self.assert_valid_flag(flag); | 304 | self.assert_valid_flag(flag); |
303 | !self.has_flag(flag) | 305 | !self.has_flag(flag) |
304 | }; | 306 | }; |
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 127d06e59..cb18c8796 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -16,6 +16,7 @@ | |||
16 | //! coerce_unsized: unsize | 16 | //! coerce_unsized: unsize |
17 | //! pin: | 17 | //! pin: |
18 | //! future: pin | 18 | //! future: pin |
19 | //! option: | ||
19 | 20 | ||
20 | pub mod marker { | 21 | pub mod marker { |
21 | // region:sized | 22 | // region:sized |
@@ -115,6 +116,17 @@ pub mod slice { | |||
115 | } | 116 | } |
116 | // endregion:slice | 117 | // endregion:slice |
117 | 118 | ||
119 | // region:option | ||
120 | pub mod option { | ||
121 | pub enum Option<T> { | ||
122 | #[lang = "None"] | ||
123 | None, | ||
124 | #[lang = "Some"] | ||
125 | Some(T), | ||
126 | } | ||
127 | } | ||
128 | // endregion:option | ||
129 | |||
118 | // region:pin | 130 | // region:pin |
119 | pub mod pin { | 131 | pub mod pin { |
120 | #[lang = "pin"] | 132 | #[lang = "pin"] |
@@ -127,7 +139,10 @@ pub mod pin { | |||
127 | 139 | ||
128 | // region:future | 140 | // region:future |
129 | pub mod future { | 141 | pub mod future { |
130 | use crate::{pin::Pin, task::{Poll, Context}}; | 142 | use crate::{ |
143 | pin::Pin, | ||
144 | task::{Context, Poll}, | ||
145 | }; | ||
131 | 146 | ||
132 | #[lang = "future_trait"] | 147 | #[lang = "future_trait"] |
133 | pub trait Future { | 148 | pub trait Future { |
@@ -153,6 +168,7 @@ pub mod task { | |||
153 | pub mod prelude { | 168 | pub mod prelude { |
154 | pub mod v1 { | 169 | pub mod v1 { |
155 | pub use crate::marker::Sized; // :sized | 170 | pub use crate::marker::Sized; // :sized |
171 | pub use crate::option::Option::{self, None, Some}; // :option | ||
156 | } | 172 | } |
157 | 173 | ||
158 | pub mod rust_2015 { | 174 | pub mod rust_2015 { |