Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Build
run: cargo build
- name: Fmt
run: cargo fmt --check
- name: Run tests
run: cargo test --examples
1 change: 0 additions & 1 deletion examples/readme/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ mod tests {
test_each_file! { in "./examples/readme/duplicate_names/" => empty}
}
}

9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,16 @@ fn generate_from_tree(
file.push(".");
file.push(extension);
let file: PathBuf = file.into();

// Canonicalize the file path
let input = match file.canonicalize() {
Ok(path) => path,
Err(e) => return Err(format!("Failed to read expected file {}.{extension}: {e}", file.display())),
Err(e) => {
return Err(format!(
"Failed to read expected file {}.{extension}: {e}",
file.display()
))
}
};
let input = input.to_str().unwrap();

Expand Down
Loading