Mercurial > python-compiler.rs
view src/tests/utils.rs @ 95:6569eea3db23
Ignore tests which don’t have the .py extension.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 28 Jun 2016 01:36:14 +0100 |
parents | e0368bea06a6 |
children |
line wrap: on
line source
use std::fs::File; use std::io::Read; pub fn read_file(filename: &str) -> String{ let mut file = match File::open(filename) { Ok(file) => file, Err(err) => { panic!(format!("Can't find {}: {}", filename, err)); } }; let mut content = String::new(); file.read_to_string(&mut content).unwrap(); content }