Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Cypher1 committed May 1, 2024
1 parent 4a9acd7 commit 1437097
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion takolib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ pub mod lowerer;
pub mod parser;
pub mod primitives;
pub mod tasks;
pub mod ui;
#[cfg(test)]
pub mod test;
pub mod ui;

pub const VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down
25 changes: 13 additions & 12 deletions takolib/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Integration tests
use std::path::PathBuf;
use log::info;
use std::fs;
use std::path::PathBuf;
use walkdir::{DirEntry, WalkDir};
use log::info;

const EXAMPLES_DIR: &'static str = "../examples";

Expand All @@ -18,10 +18,11 @@ const EXCEPTIONS: &'static [&'static str] = &[
];

fn is_hidden(entry: &DirEntry) -> bool {
entry.file_name()
.to_str()
.map(|s| s.starts_with("."))
.unwrap_or(false)
entry
.file_name()
.to_str()
.map(|s| s.starts_with("."))
.unwrap_or(false)
}

fn find_files() -> Result<Vec<PathBuf>, walkdir::Error> {
Expand Down Expand Up @@ -54,8 +55,7 @@ fn find_example_files() {
info!("Files: {files:#?}");
let num_files = files.len();
assert_eq!(
num_files,
1,
num_files, 1,
"Example files appear to be missing, found {num_files}"
);
}
Expand All @@ -67,14 +67,15 @@ fn parse_example_files() {

for file in files {
info!("Start: {file:#?}");
let contents = fs::read_to_string(&file)
.expect("Should have been able to read the file");
let contents = fs::read_to_string(&file).expect("Should have been able to read the file");

let tokens = crate::parser::tokens::lex(&contents).expect(&format!("Should be able to lex: {file:?}"));
let tokens = crate::parser::tokens::lex(&contents)
.expect(&format!("Should be able to lex: {file:?}"));

info!("Tokens: {tokens:#?}");

let _ast = crate::parser::parse(&file, &contents, &tokens).expect(&format!("Should be able to parse: {file:?}"));
let _ast = crate::parser::parse(&file, &contents, &tokens)
.expect(&format!("Should be able to parse: {file:?}"));
info!("Done: {file:#?}");
}
}

0 comments on commit 1437097

Please sign in to comment.