-
Notifications
You must be signed in to change notification settings - Fork 129
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
Add args: --edit-page
and --edit-patch
#388
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -990,3 +990,67 @@ fn test_raw_render_file() { | |
.success() | ||
.stdout(diff(include_str!("cache/pages/common/inkscape-v1.md"))); | ||
} | ||
|
||
fn touch_custom_page(testenv: &TestEnv) { | ||
let args = vec!["--edit-page", "foo"]; | ||
|
||
testenv | ||
.command() | ||
.args(&args) | ||
.env("EDITOR", "touch") | ||
.assert() | ||
.success(); | ||
assert!(testenv.custom_pages_dir.path().join("foo.page.md").exists()); | ||
} | ||
|
||
fn touch_custom_patch(testenv: &TestEnv) { | ||
let args = vec!["--edit-patch", "foo"]; | ||
|
||
testenv | ||
.command() | ||
.args(&args) | ||
.env("EDITOR", "touch") | ||
.assert() | ||
.success(); | ||
assert!(testenv | ||
.custom_pages_dir | ||
.path() | ||
.join("foo.patch.md") | ||
.exists()); | ||
} | ||
|
||
#[test] | ||
fn test_edit_page() { | ||
let testenv = TestEnv::new().write_custom_pages_config(); | ||
touch_custom_page(&testenv); | ||
} | ||
|
||
#[test] | ||
fn test_edit_patch() { | ||
let testenv = TestEnv::new().write_custom_pages_config(); | ||
touch_custom_patch(&testenv); | ||
} | ||
|
||
#[test] | ||
fn test_recreate_dir() { | ||
let testenv = TestEnv::new().write_custom_pages_config(); | ||
touch_custom_patch(&testenv); | ||
touch_custom_page(&testenv); | ||
} | ||
|
||
#[test] | ||
fn test_custom_pages_dir_is_not_dir() { | ||
let testenv = TestEnv::new().write_custom_pages_config(); | ||
let _ = std::fs::remove_dir_all(testenv.custom_pages_dir.path()); | ||
let _ = File::create(testenv.custom_pages_dir.path()).unwrap(); | ||
Comment on lines
+1044
to
+1045
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this might be a problem, because the created file is not automatically deleted after the tests are finished. However, I think we should in general change our test environment to place everything in unified temporary directory instead of creating multiple ones. I will make a follow up issue, so we can leave it as is for now |
||
assert!(testenv.custom_pages_dir.path().is_file()); | ||
|
||
let args = vec!["--edit-patch", "foo"]; | ||
|
||
testenv | ||
.command() | ||
.args(&args) | ||
.env("EDITOR", "touch") | ||
.assert() | ||
.failure(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #388 (comment)