Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit 588998b

Browse files
committed
fix typo
Signed-off-by: Freyskeyd <[email protected]>
1 parent a334616 commit 588998b

File tree

2 files changed

+125
-36
lines changed

2 files changed

+125
-36
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ matrix:
1111
env: CLIPPY_VERS="0.0.165"
1212
before_script: |
1313
[[ "$(cargo +nightly-2017-10-09 clippy --version)" != "$CLIPPY_VERS" ]] && \
14-
cargo +nightly-2017-10-09 install clippy --vers "$CLIPPY_VERS" --force
14+
cargo +nightly-2017-10-09 install clippy --vers "$CLIPPY_VERS" --force || true
1515
script: |
1616
cargo +nightly-2017-10-09 clippy -- -D warnings
1717
- rust: nightly-2017-10-09
1818
env: RUSTFMT_VERS="0.2.8"
1919
before_script: |
2020
[[ "$(cargo +nightly-2017-10-09 fmt -- --version)" != "$RUSTFMT_VERS"* ]] && \
21-
cargo +nightly-2017-10-09 install rustfmt-nightly --vers "$RUSTFMT_VERS" --force
21+
cargo +nightly-2017-10-09 install rustfmt-nightly --vers "$RUSTFMT_VERS" --force || true
2222
script: |
2323
cargo +nightly-2017-10-09 fmt --all -- --write-mode=diff
2424
before_script:

src/environment.rs

Lines changed: 123 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ impl<'s, T: ToString, Z: ToString> EnvironmentItem for &'s (T, Z) {
9393
}
9494

9595
impl<'s, T> From<T> for Environment
96-
where T: IntoIterator, T::Item: EnvironmentItem
96+
where
97+
T: IntoIterator,
98+
T::Item: EnvironmentItem
9799
{
98100
fn from(v: T) -> Self {
99101
Self {
100-
vars: v.into_iter()
101-
.map(|k| k.to_environment_tuple())
102-
.collect(),
102+
vars: v.into_iter().map(|k| k.to_environment_tuple()).collect(),
103103
inherit: false,
104104
}
105105
}
@@ -109,7 +109,7 @@ impl<'s, T> From<T> for Environment
109109
#[cfg(test)]
110110
mod test {
111111
use super::*;
112-
use ::Assert;
112+
use Assert;
113113

114114
fn command() -> Assert {
115115
Assert::command(&["printenv"])
@@ -119,10 +119,7 @@ mod test {
119119
fn take_ownership() {
120120
let x = Environment::inherit();
121121

122-
command()
123-
.with_env(x.clone())
124-
.with_env(&x)
125-
.with_env(x);
122+
command().with_env(x.clone()).with_env(&x).with_env(x);
126123
}
127124

128125
#[test]
@@ -138,11 +135,14 @@ mod test {
138135
fn in_place_mod2() {
139136
let x = Environment::inherit();
140137

141-
assert!(command()
142-
.with_env(&x.insert("key", "value").insert("key", "vv"))
143-
.stdout().contains("key=vv")
144-
.execute()
145-
.is_ok());
138+
assert!(
139+
command()
140+
.with_env(&x.insert("key", "value").insert("key", "vv"))
141+
.stdout()
142+
.contains("key=vv")
143+
.execute()
144+
.is_ok()
145+
);
146146
// Granted, `insert` moved `x`, so we can no longer reference it, even
147147
// though only a reference was passed to `with_env`
148148
}
@@ -152,55 +152,144 @@ mod test {
152152
// In-place modification while allowing later accesses to the `Environment`
153153
let y = Environment::empty();
154154

155-
assert_eq!(y.clone().insert("key", "value").compile(), vec![("key".to_string(), "value".to_string())]);
156-
assert!(command()
157-
.with_env(y)
158-
.stdout().not().contains("key=value")
159-
.execute().is_ok());
155+
assert_eq!(
156+
y.clone().insert("key", "value").compile(),
157+
vec![("key".to_string(), "value".to_string())]
158+
);
159+
160+
assert!(
161+
command()
162+
.with_env(y)
163+
.stdout()
164+
.not()
165+
.contains("key=value")
166+
.execute()
167+
.is_ok()
168+
);
160169
}
161170

162171
#[test]
163172
fn empty_env() {
164173
// In-place modification while allowing later accesses to the `Environment`
165174
let y = Environment::empty();
166175

167-
assert!(command()
168-
.with_env(y)
169-
.stdout().is("")
170-
.execute().is_ok());
176+
assert!(command().with_env(y).stdout().is("").execute().is_ok());
171177
}
172178
#[test]
173179
fn take_vec() {
174180
let v = vec![("bar".to_string(), "baz".to_string())];
175181

176-
assert!(command().with_env(&vec![("bar", "baz")]).stdout().contains("bar=baz").execute().is_ok());
177-
assert!(command().with_env(&v).stdout().contains("bar=baz").execute().is_ok());
178-
assert!(command().with_env(&vec![("bar", "baz")]).stdout().isnt("").execute().is_ok());
182+
assert!(
183+
command()
184+
.with_env(&vec![("bar", "baz")])
185+
.stdout()
186+
.contains("bar=baz")
187+
.execute()
188+
.is_ok()
189+
);
190+
191+
assert!(
192+
command()
193+
.with_env(&v)
194+
.stdout()
195+
.contains("bar=baz")
196+
.execute()
197+
.is_ok()
198+
);
199+
200+
assert!(
201+
command()
202+
.with_env(&vec![("bar", "baz")])
203+
.stdout()
204+
.isnt("")
205+
.execute()
206+
.is_ok()
207+
);
179208
}
180209

181210
#[test]
182211
fn take_slice_of_strs() {
183-
assert!(command().with_env(&[("bar", "BAZ")]).stdout().contains("bar=BAZ").execute().is_ok());
184-
assert!(command().with_env(&[("bar", "BAZ")][..]).stdout().contains("bar=BAZ").execute().is_ok());
185-
assert!(command().with_env([("bar", "BAZ")].as_ref()).stdout().contains("bar=BAZ").execute().is_ok());
212+
assert!(
213+
command()
214+
.with_env(&[("bar", "BAZ")])
215+
.stdout()
216+
.contains("bar=BAZ")
217+
.execute()
218+
.is_ok()
219+
);
220+
221+
assert!(
222+
command()
223+
.with_env(&[("bar", "BAZ")][..])
224+
.stdout()
225+
.contains("bar=BAZ")
226+
.execute()
227+
.is_ok()
228+
);
229+
230+
assert!(
231+
command()
232+
.with_env([("bar", "BAZ")].as_ref())
233+
.stdout()
234+
.contains("bar=BAZ")
235+
.execute()
236+
.is_ok()
237+
);
186238
}
187239

188240
#[test]
189241
fn take_slice_of_strings() {
190242
// same deal as above
191243

192-
assert!(command().with_env(&[("bar".to_string(), "BAZ".to_string())]).stdout().contains("bar=BAZ").execute().is_ok());
193-
assert!(command().with_env(&[("bar".to_string(), "BAZ".to_string())][..]).stdout().contains("bar=BAZ").execute().is_ok());
244+
assert!(
245+
command()
246+
.with_env(&[("bar".to_string(), "BAZ".to_string())])
247+
.stdout()
248+
.contains("bar=BAZ")
249+
.execute()
250+
.is_ok()
251+
);
252+
253+
assert!(
254+
command()
255+
.with_env(&[("bar".to_string(), "BAZ".to_string())][..])
256+
.stdout()
257+
.contains("bar=BAZ")
258+
.execute()
259+
.is_ok()
260+
);
194261
}
195262

196263
#[test]
197264
fn take_slice() {
198-
assert!(command().with_env(&[("hey", "ho")]).stdout().contains("hey=ho").execute().is_ok());
199-
assert!(command().with_env(&[("hey", "ho".to_string())]).stdout().contains("hey=ho").execute().is_ok());
265+
assert!(
266+
command()
267+
.with_env(&[("hey", "ho")])
268+
.stdout()
269+
.contains("hey=ho")
270+
.execute()
271+
.is_ok()
272+
);
273+
274+
assert!(
275+
command()
276+
.with_env(&[("hey", "ho".to_string())])
277+
.stdout()
278+
.contains("hey=ho")
279+
.execute()
280+
.is_ok()
281+
);
200282
}
201283

202284
#[test]
203285
fn take_string_i32() {
204-
assert!(command().with_env(&[("bar", 3 as i32)]).stdout().contains("bar=3").execute().is_ok());
286+
assert!(
287+
command()
288+
.with_env(&[("bar", 3 as i32)])
289+
.stdout()
290+
.contains("bar=3")
291+
.execute()
292+
.is_ok()
293+
);
205294
}
206295
}

0 commit comments

Comments
 (0)