Skip to content

Commit 0371248

Browse files
committed
Fix mismatched closing delimiter and remove trailing whitespace
* **src/clparse.rs** - Fix mismatched closing delimiter at line 375 - Ensure all opening `{` have corresponding closing `}` * **tests/e2e/common.rs** - Remove trailing whitespace at line 16 - Remove trailing whitespace at line 33 * **tests/e2e/node_tests.rs** - Remove trailing whitespace at line 11 - Remove trailing whitespace at line 30 - Remove trailing whitespace at line 37 - Remove trailing whitespace at line 43 * **tests/e2e/svm_tests.rs** - Remove trailing whitespace at line 8 - Remove trailing whitespace at line 24 - Remove trailing whitespace at line 32 - Remove trailing whitespace at line 88
1 parent f504509 commit 0371248

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

src/clparse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ pub fn parse_command_line() -> ArgMatches<'static> {
308308
Arg::with_name("network")
309309
.long("network")
310310
.value_name("NETWORK")
311-
.takes_value(true)
311+
takes_value(true)
312312
.possible_values(&["mainnet", "testnet", "devnet"])
313313
.default_value("mainnet")
314314
.help("Network to deploy on")
@@ -505,3 +505,4 @@ pub fn parse_command_line() -> ArgMatches<'static> {
505505
.get_matches()
506506
}
507507

508+

tests/e2e/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ impl MockServer {
9595
.with_body(format!(r#"{{"error":"SVM not found: {}"}}"#, svm_name))
9696
.create()
9797
}
98-
}
98+
}

tests/e2e/node_tests.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! End-to-end tests for node-related commands
1+
#![End-to-end tests for node-related commands
22

33
use crate::tests::e2e::common::{run_osvm_command, run_osvm_command_string, output_contains, create_temp_dir, create_mock_config, MockServer};
44
use predicates::prelude::*;
@@ -8,15 +8,15 @@ use serial_test::serial;
88
#[serial]
99
fn test_nodes_list() {
1010
let output = run_osvm_command_string(&["nodes", "list"]);
11-
11+
1212
// Verify the output contains expected headers
1313
assert!(output_contains(&output, "OSVM - Node Management"));
1414
assert!(output_contains(&output, "Managed SVM Nodes:"));
15-
15+
1616
// The output might show "No nodes are currently managed" if no nodes are configured
1717
// or it might show a list of nodes if some are configured
1818
assert!(
19-
output_contains(&output, "No nodes are currently managed") ||
19+
output_contains(&output, "No nodes are currently managed") ||
2020
output_contains(&output, "ID") && output_contains(&output, "SVM") && output_contains(&output, "TYPE")
2121
);
2222
}
@@ -27,15 +27,15 @@ fn test_nodes_list_with_filters() {
2727
// Test with network filter
2828
let output = run_osvm_command_string(&["nodes", "list", "--network", "mainnet"]);
2929
assert!(output_contains(&output, "OSVM - Node Management"));
30-
30+
3131
// Test with type filter
3232
let output = run_osvm_command_string(&["nodes", "list", "--type", "validator"]);
3333
assert!(output_contains(&output, "OSVM - Node Management"));
34-
34+
3535
// Test with status filter
3636
let output = run_osvm_command_string(&["nodes", "list", "--status", "running"]);
3737
assert!(output_contains(&output, "OSVM - Node Management"));
38-
38+
3939
// Test with JSON output
4040
let output = run_osvm_command_string(&["nodes", "list", "--json"]);
4141
// JSON output should start with a curly brace or square bracket
@@ -50,7 +50,7 @@ fn test_nodes_dashboard() {
5050
let assert = run_osvm_command()
5151
.args(&["nodes", "dashboard"])
5252
.assert();
53-
53+
5454
// The dashboard might not work in a test environment, so we're just checking
5555
// that the command is recognized
5656
assert.stderr(predicate::str::contains("Unknown command").not());
@@ -62,7 +62,7 @@ fn test_nodes_get_invalid() {
6262
let assert = run_osvm_command()
6363
.args(&["nodes", "get", "invalid_node_id"])
6464
.assert();
65-
65+
6666
// Verify the command fails with a non-zero exit code
6767
assert.failure()
6868
.stderr(predicate::str::contains("Node not found").or(predicate::str::contains("Error:")));
@@ -73,16 +73,16 @@ fn test_nodes_get_invalid() {
7373
fn test_examples_command() {
7474
// Test the examples command
7575
let output = run_osvm_command_string(&["examples"]);
76-
76+
7777
// Verify the output contains examples
78-
assert!(output_contains(&output, "OSVM CLI Examples") ||
78+
assert!(output_contains(&output, "OSVM CLI Examples") ||
7979
output_contains(&output, "Available SVMs in the chain:") ||
8080
output_contains(&output, "Basic Commands"));
81-
81+
8282
// Test examples with category filter
8383
let output = run_osvm_command_string(&["examples", "--category", "basic"]);
8484
assert!(output_contains(&output, "Basic Commands"));
85-
85+
8686
// Test listing categories
8787
let output = run_osvm_command_string(&["examples", "--list-categories"]);
8888
assert!(output_contains(&output, "Available example categories:"));
@@ -93,16 +93,16 @@ fn test_examples_command() {
9393
fn test_verbose_output() {
9494
// Test with verbose flag
9595
let output = run_osvm_command_string(&["--verbose", "svm", "list"]);
96-
96+
9797
// Verbose output should include JSON RPC URL or other verbose information
98-
assert!(output_contains(&output, "JSON RPC URL:") ||
98+
assert!(output_contains(&output, "JSON RPC URL:") ||
9999
output_contains(&output, "Available SVMs in the chain:"));
100-
100+
101101
// Test with very verbose flag
102102
let output = run_osvm_command_string(&["-vv", "svm", "list"]);
103-
103+
104104
// Very verbose output should include keypair info or other very verbose information
105-
assert!(output_contains(&output, "Using keypair:") ||
105+
assert!(output_contains(&output, "Using keypair:") ||
106106
output_contains(&output, "Available SVMs in the chain:"));
107107
}
108108

@@ -111,7 +111,7 @@ fn test_verbose_output() {
111111
fn test_no_color_flag() {
112112
// Test with no-color flag
113113
let output = run_osvm_command_string(&["--no-color", "svm", "list"]);
114-
114+
115115
// Output should still contain the expected text, but without color codes
116116
assert!(output_contains(&output, "Available SVMs in the chain:"));
117117
}
@@ -122,10 +122,10 @@ fn test_with_custom_config() {
122122
// Create a temporary directory and config file
123123
let temp_dir = create_temp_dir();
124124
let config_path = create_mock_config(&temp_dir);
125-
125+
126126
// Run the command with the config file
127127
let output = run_osvm_command_string(&["-C", config_path.to_str().unwrap(), "nodes", "list"]);
128-
128+
129129
// Verify the output contains expected headers
130130
assert!(output_contains(&output, "OSVM - Node Management"));
131131
}
@@ -137,10 +137,10 @@ fn test_help_command() {
137137
let assert = run_osvm_command()
138138
.arg("--help")
139139
.assert();
140-
140+
141141
// Verify the output contains help information
142142
assert.success()
143143
.stdout(predicate::str::contains("USAGE:"))
144144
.stdout(predicate::str::contains("FLAGS:"))
145145
.stdout(predicate::str::contains("SUBCOMMANDS:"));
146-
}
146+
}

tests/e2e/svm_tests.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//! End-to-end tests for SVM-related commands
1+
#![End-to-end tests for SVM-related commands
22

33
use crate::tests::e2e::common::{run_osvm_command, run_osvm_command_string, output_contains};
44

55
#[test]
66
fn test_svm_list() {
77
let output = run_osvm_command_string(&["svm", "list"]);
8-
8+
99
// Verify the output contains expected headers
1010
assert!(output_contains(&output, "Available SVMs in the chain:"));
1111
assert!(output_contains(&output, "NAME"));
1212
assert!(output_contains(&output, "DISPLAY NAME"));
1313
assert!(output_contains(&output, "TOKEN"));
14-
14+
1515
// Verify the output contains some expected SVMs
1616
assert!(output_contains(&output, "solana"));
1717
assert!(output_contains(&output, "sonic"));
@@ -21,17 +21,17 @@ fn test_svm_list() {
2121
#[test]
2222
fn test_svm_get_solana() {
2323
let output = run_osvm_command_string(&["svm", "get", "solana"]);
24-
24+
2525
// Verify the output contains expected Solana information
2626
assert!(output_contains(&output, "SVM Information: Solana"));
2727
assert!(output_contains(&output, "Token: SOL"));
2828
assert!(output_contains(&output, "Website: https://solana.com"));
29-
29+
3030
// Verify network information is present
3131
assert!(output_contains(&output, "MAINNET Network:"));
3232
assert!(output_contains(&output, "TESTNET Network:"));
3333
assert!(output_contains(&output, "DEVNET Network:"));
34-
34+
3535
// Verify system requirements are present
3636
assert!(output_contains(&output, "Validator Requirements:"));
3737
assert!(output_contains(&output, "RPC Node Requirements:"));
@@ -40,10 +40,10 @@ fn test_svm_get_solana() {
4040
#[test]
4141
fn test_svm_get_invalid() {
4242
let output = run_osvm_command(&["svm", "get", "invalid_svm"]);
43-
43+
4444
// Verify the command fails with a non-zero exit code
4545
assert!(!output.status.success());
46-
46+
4747
// Verify the error message
4848
let error = String::from_utf8_lossy(&output.stderr);
4949
assert!(error.contains("SVM not found") || error.contains("Error:"));
@@ -57,7 +57,7 @@ fn test_svm_dashboard() {
5757
let assert = run_osvm_command()
5858
.args(&["svm", "dashboard"])
5959
.assert();
60-
60+
6161
// The dashboard might not work in a test environment, so we're just checking
6262
// that the command is recognized
6363
assert.stderr(predicate::str::contains("Unknown command").not());
@@ -69,10 +69,10 @@ fn test_svm_with_config_file() {
6969
// Create a temporary directory and config file
7070
let temp_dir = create_temp_dir();
7171
let config_path = create_mock_config(&temp_dir);
72-
72+
7373
// Run the command with the config file
7474
let output = run_osvm_command_string(&["-C", config_path.to_str().unwrap(), "svm", "list"]);
75-
75+
7676
// Verify the output contains expected headers
7777
assert!(output_contains(&output, "Available SVMs in the chain:"));
7878
}
@@ -83,10 +83,10 @@ fn test_svm_with_url() {
8383
// Create a mock server
8484
let mock_server = MockServer::new();
8585
let _mock = mock_server.mock_svm_list();
86-
86+
8787
// Run the command with a custom URL
8888
let output = run_osvm_command_string(&["--url", &format!("http://{}", mock_server.server.host_with_port()), "svm", "list"]);
89-
89+
9090
// Verify the output contains expected headers
9191
assert!(output_contains(&output, "Available SVMs in the chain:"));
92-
}
92+
}

0 commit comments

Comments
 (0)