]>
git.proxmox.com Git - rustc.git/blob - src/test/run-make/cannot-read-embedded-idents/create_and_compile.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(old_io, old_path)]
15 use std
::process
::Command
;
19 // creates broken.rs, which has the Ident \x00name_0,ctxt_0\x00
20 // embedded within it, and then attempts to compile broken.rs with the
24 let args
: Vec
<String
> = env
::args().collect();
26 let tmpdir
= Path
::new(&args
[2]);
28 let main_file
= tmpdir
.join("broken.rs");
29 let _
= File
::create(&main_file
).unwrap()
30 .write_all(b
"pub fn main() {
31 let \x00name_0,ctxt_0\x00 = 3;
32 println!(\"{}\", \x00name_0,ctxt_0\x00);
35 // rustc is passed to us with --out-dir and -L etc., so we
36 // can't exec it directly
37 let result
= Command
::new("sh")
39 .arg(&format
!("{} {}", rustc
, main_file
.display()))
41 let err
= String
::from_utf8_lossy(&result
.stderr
);
43 // positive test so that this test will be updated when the
45 assert
!(err
.contains("unknown start of token"))