add assert_cmd to test binaries
This commit is contained in:
		
							parent
							
								
									83355e140a
								
							
						
					
					
						commit
						49b39f403b
					
				
							
								
								
									
										82
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										82
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -150,6 +150,22 @@ dependencies = [ | |||||||
|  "windows-sys 0.52.0", |  "windows-sys 0.52.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "assert_cmd" | ||||||
|  | version = "2.0.16" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" | ||||||
|  | dependencies = [ | ||||||
|  |  "anstyle", | ||||||
|  |  "bstr", | ||||||
|  |  "doc-comment", | ||||||
|  |  "libc", | ||||||
|  |  "predicates", | ||||||
|  |  "predicates-core", | ||||||
|  |  "predicates-tree", | ||||||
|  |  "wait-timeout", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "async-trait" | name = "async-trait" | ||||||
| version = "0.1.82" | version = "0.1.82" | ||||||
| @ -272,6 +288,17 @@ dependencies = [ | |||||||
|  "cipher", |  "cipher", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "bstr" | ||||||
|  | version = "1.12.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" | ||||||
|  | dependencies = [ | ||||||
|  |  "memchr", | ||||||
|  |  "regex-automata", | ||||||
|  |  "serde", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "bumpalo" | name = "bumpalo" | ||||||
| version = "3.16.0" | version = "3.16.0" | ||||||
| @ -697,6 +724,12 @@ version = "0.1.13" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" | checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "difflib" | ||||||
|  | version = "0.4.0" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "digest" | name = "digest" | ||||||
| version = "0.10.7" | version = "0.10.7" | ||||||
| @ -720,6 +753,12 @@ dependencies = [ | |||||||
|  "syn", |  "syn", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "doc-comment" | ||||||
|  | version = "0.3.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "ecdsa" | name = "ecdsa" | ||||||
| version = "0.16.9" | version = "0.16.9" | ||||||
| @ -842,6 +881,7 @@ version = "0.0.0" | |||||||
| name = "example-cli" | name = "example-cli" | ||||||
| version = "0.1.0" | version = "0.1.0" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  |  "assert_cmd", | ||||||
|  "cidr", |  "cidr", | ||||||
|  "env_logger", |  "env_logger", | ||||||
|  "harmony", |  "harmony", | ||||||
| @ -2482,6 +2522,33 @@ dependencies = [ | |||||||
|  "zerocopy", |  "zerocopy", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "predicates" | ||||||
|  | version = "3.1.3" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" | ||||||
|  | dependencies = [ | ||||||
|  |  "anstyle", | ||||||
|  |  "difflib", | ||||||
|  |  "predicates-core", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "predicates-core" | ||||||
|  | version = "1.0.9" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" | ||||||
|  | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "predicates-tree" | ||||||
|  | version = "1.0.12" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" | ||||||
|  | dependencies = [ | ||||||
|  |  "predicates-core", | ||||||
|  |  "termtree", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "pretty_assertions" | name = "pretty_assertions" | ||||||
| version = "1.4.1" | version = "1.4.1" | ||||||
| @ -3426,6 +3493,12 @@ dependencies = [ | |||||||
|  "windows-sys 0.59.0", |  "windows-sys 0.59.0", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "termtree" | ||||||
|  | version = "0.5.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "thiserror" | name = "thiserror" | ||||||
| version = "1.0.63" | version = "1.0.63" | ||||||
| @ -3826,6 +3899,15 @@ version = "0.9.5" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" | ||||||
| 
 | 
 | ||||||
|  | [[package]] | ||||||
|  | name = "wait-timeout" | ||||||
|  | version = "0.2.1" | ||||||
|  | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
|  | checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" | ||||||
|  | dependencies = [ | ||||||
|  |  "libc", | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "want" | name = "want" | ||||||
| version = "0.3.1" | version = "0.3.1" | ||||||
|  | |||||||
| @ -16,3 +16,4 @@ harmony_macros = { path = "../../harmony_macros" } | |||||||
| log = { workspace = true } | log = { workspace = true } | ||||||
| env_logger = { workspace = true } | env_logger = { workspace = true } | ||||||
| url = { workspace = true } | url = { workspace = true } | ||||||
|  | assert_cmd = "2.0.16" | ||||||
|  | |||||||
| @ -18,3 +18,13 @@ async fn main() { | |||||||
|     ]); |     ]); | ||||||
|     harmony_cli::init(maestro).await.unwrap(); |     harmony_cli::init(maestro).await.unwrap(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | use assert_cmd::Command; | ||||||
|  | 
 | ||||||
|  | #[test] | ||||||
|  | fn test_example() { | ||||||
|  |     let mut cmd = Command::cargo_bin("example-cli").unwrap(); | ||||||
|  |     let assert = cmd.arg("--run").arg("SuccessScore").assert(); | ||||||
|  | 
 | ||||||
|  |     assert.success(); | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user