Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use workspace folder instead of CWD for file paths in test #123

Merged
merged 1 commit into from
Jan 8, 2024
Merged
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
14 changes: 8 additions & 6 deletions src/csl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2835,23 +2835,25 @@ enum SpecialForm {

#[cfg(test)]
mod tests {
use citationberg::LocaleFile;
use std::{fs, path::Path};

use crate::io::from_yaml_str;
use citationberg::LocaleFile;

use super::*;
use std::fs;
use crate::io::from_yaml_str;

#[test]
fn test_csl() {
let en_locale = fs::read_to_string("tests/data/locales-en-US.xml").unwrap();
let workspace = Path::new(env!("CARGO_MANIFEST_DIR"));
let en_locale =
fs::read_to_string(workspace.join("tests/data/locales-en-US.xml")).unwrap();
let en_locale = LocaleFile::from_xml(&en_locale).unwrap();

let yaml = fs::read_to_string("tests/data/basic.yml").unwrap();
let yaml = fs::read_to_string(workspace.join("tests/data/basic.yml")).unwrap();
let bib = from_yaml_str(&yaml).unwrap();
let en_locale = [en_locale.into()];

for style_thing in fs::read_dir("../styles/").unwrap().take(100) {
for style_thing in fs::read_dir(workspace.join("styles/")).unwrap().take(100) {
let thing = style_thing.unwrap();
if thing.file_type().unwrap().is_dir() {
continue;
Expand Down