Skip to content

Commit

Permalink
feat(#10): clean for check
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Sep 24, 2024
1 parent 470980e commit 0e0b299
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/compiler/fsl_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ impl Fslc {
/// New compiler for program in file.
pub fn file(path: &Path) -> Fslc {
Fslc {
program: fs::read_to_string(path)
.expect(&format!("Failed to read path {}", path.display())),
program: fs::read_to_string(path).unwrap_or_else(|_| {
panic!("Failed to read path: {}", path.display())
}),
parser: FslParser {},
}
}
Expand All @@ -72,19 +73,19 @@ mod tests {
fn compiles_program_as_string() -> Result<()> {
testing_logger::setup();
Fslc::program(String::from("me: @jeff +repo me/foo")).out();
testing_logger::validate( |logs| {
testing_logger::validate(|logs| {
assert_eq!(logs.len(), 1);
assert_eq!(logs[0].body, "Done!");
assert_eq!(logs[0].level, Level::Info);
});
Ok(())
}

#[test]
fn compiles_program_from_file() -> Result<()> {
testing_logger::setup();
Fslc::file(Path::new("resources/programs/me.fsl")).out();
testing_logger::validate( |logs| {
testing_logger::validate(|logs| {
assert_eq!(logs.len(), 1);
assert_eq!(logs[0].body, "Done!");
assert_eq!(logs[0].level, Level::Info);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ FSL.
#[allow(unused_imports)]
#[macro_use]
extern crate hamcrest;
/// FSL Parser.
pub mod parser;
/// FSL Compiler.
pub mod compiler;
/// FSL Parser.
pub mod parser;

0 comments on commit 0e0b299

Please sign in to comment.