mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 12:35:28 +00:00
add tests for symbolically linked files & directories
trying to reproduce issue #60
This commit is contained in:
parent
f890de24f6
commit
14e15d430a
4 changed files with 63 additions and 0 deletions
1
tests/data/content/symlink.gmi
Symbolic link
1
tests/data/content/symlink.gmi
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
index.gmi
|
||||
1
tests/data/content/symlinked_dir
Symbolic link
1
tests/data/content/symlinked_dir
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../symlinked_dir/
|
||||
1
tests/data/symlinked_dir/file.gmi
Normal file
1
tests/data/symlinked_dir/file.gmi
Normal file
|
|
@ -0,0 +1 @@
|
|||
Hello from the symlink'ed directory!
|
||||
|
|
@ -145,6 +145,66 @@ fn index_page() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// - symlinked files are followed correctly
|
||||
fn symlink_page() {
|
||||
let page = get(
|
||||
&["--addr", "[::]:1986"],
|
||||
addr(1986),
|
||||
"gemini://localhost/symlink.gmi",
|
||||
)
|
||||
.expect("could not get page");
|
||||
|
||||
assert_eq!(
|
||||
page.header,
|
||||
Header {
|
||||
status: Status::Success,
|
||||
meta: "text/gemini".to_string(),
|
||||
}
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
page.body,
|
||||
Some(
|
||||
std::fs::read_to_string(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/tests/data/content/index.gmi"
|
||||
))
|
||||
.unwrap()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// - symlinked directories are followed correctly
|
||||
fn symlink_directory() {
|
||||
let page = get(
|
||||
&["--addr", "[::]:1987"],
|
||||
addr(1987),
|
||||
"gemini://localhost/symlinked_dir/file.gmi",
|
||||
)
|
||||
.expect("could not get page");
|
||||
|
||||
assert_eq!(
|
||||
page.header,
|
||||
Header {
|
||||
status: Status::Success,
|
||||
meta: "text/gemini".to_string(),
|
||||
}
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
page.body,
|
||||
Some(
|
||||
std::fs::read_to_string(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/tests/data/symlinked_dir/file.gmi"
|
||||
))
|
||||
.unwrap()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// - the `--addr` configuration works
|
||||
/// - MIME media types can be set in the configuration file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue