2014-02-07 20:08:32 +01:00
|
|
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
2012-12-10 17:32:48 -08:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2014-02-07 20:08:32 +01:00
|
|
|
// ignore-fast
|
2012-12-14 16:50:08 -08:00
|
|
|
|
2014-03-14 11:16:10 -07:00
|
|
|
use std::io::{File, TempDir};
|
2012-11-09 17:50:23 -08:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2014-03-14 11:16:10 -07:00
|
|
|
let dir = TempDir::new_in(&Path::new("."), "").unwrap();
|
2013-10-05 19:49:32 -07:00
|
|
|
let path = dir.path().join("file");
|
2012-11-09 17:50:23 -08:00
|
|
|
|
|
|
|
{
|
2013-10-29 23:31:07 -07:00
|
|
|
match File::create(&path) {
|
2014-01-30 11:56:51 -08:00
|
|
|
Err(..) => unreachable!(),
|
|
|
|
Ok(f) => {
|
2013-10-13 18:48:47 -07:00
|
|
|
let mut f = f;
|
2013-08-03 12:45:23 -04:00
|
|
|
for _ in range(0u, 1000) {
|
2013-10-13 18:48:47 -07:00
|
|
|
f.write([0]);
|
2012-11-09 17:50:23 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-28 18:39:09 -07:00
|
|
|
assert!(path.exists());
|
2014-01-30 11:56:51 -08:00
|
|
|
assert_eq!(path.stat().unwrap().size, 1000);
|
2012-11-09 17:50:23 -08:00
|
|
|
}
|