-
Notifications
You must be signed in to change notification settings - Fork 16
fix(flags): add a new experimental-features flag to gate new features starting with the existing "tui" flag #385
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
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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| use std::path::PathBuf; | ||
|
|
||
| use test_harness::test; | ||
| use test_harness::GhciWatchBuilder; | ||
| use tokio::process::Command; | ||
|
|
||
| /// Invalid experimental feature values should produce an error immediately. | ||
| #[test] | ||
| async fn invalid_experimental_feature_errors() { | ||
| let result = GhciWatchBuilder::new("tests/data/simple") | ||
| .with_args(["--experimental-features", "asdflkj"]) | ||
| .start() | ||
| .await; | ||
| assert!( | ||
| result.is_err(), | ||
| "ghciwatch should error on invalid experimental feature" | ||
| ); | ||
| } | ||
|
|
||
| /// Runs ghciwatch directly (not via `GhciWatchBuilder`) because TUI mode | ||
| /// crashes without a terminal, exiting before the test harness can connect. | ||
|
Comment on lines
+20
to
+21
Member
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. Oh man, that's frustrating!! Maybe we can replace this with a test for your feature when we get that merged lol
Contributor
Author
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. Lol yes! That was the main issue I ran into trying to get the tests running. |
||
| #[tokio::test] | ||
| async fn experimental_features_emits_warning() { | ||
| let log_dir = PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("experimental-warning"); | ||
| std::fs::create_dir_all(&log_dir).expect("can create log dir"); | ||
| let log_path = log_dir.join("ghciwatch.json"); | ||
|
|
||
| let _output = Command::new(env!("CARGO_BIN_EXE_ghciwatch")) | ||
| .args(["--experimental-features", "tui"]) | ||
| .arg("--log-json") | ||
| .arg(&log_path) | ||
| .args(["--watch", "src"]) | ||
| .current_dir("tests/data/simple") | ||
| .output() | ||
| .await | ||
| .expect("can run ghciwatch"); | ||
|
|
||
| let log_contents = std::fs::read_to_string(&log_path) | ||
| .unwrap_or_else(|e| panic!("can read log file at {}: {e}", log_path.display())); | ||
| assert!( | ||
| log_contents.contains("--experimental-features"), | ||
| "warning about experimental features should appear in JSON log" | ||
| ); | ||
|
|
||
| let _ = std::fs::remove_dir_all(&log_dir); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.