()
| 11 | |
| 12 | #[test] |
| 13 | fn test_license_validation() { |
| 14 | // Release floating license if we already have one, otherwise the failure will succeed. |
| 15 | release_license(); |
| 16 | // Make sure we properly report invalid license. |
| 17 | let options = InitializationOptions::default() |
| 18 | .with_license_checkout(false) |
| 19 | .with_license("blah blag"); |
| 20 | match init_with_opts(options) { |
| 21 | Ok(_) => panic!("Expected license validation to fail, but it succeeded!"), |
| 22 | Err(InitializationError::InvalidLicense) => {} |
| 23 | Err(e) => panic!("Unexpected error: {:?}", e), |
| 24 | } |
| 25 | // Reset the license so that it actually can validate license. |
| 26 | set_license::<String>(None); |
| 27 | // Actually make sure we can initialize. |
| 28 | init().expect("Failed to initialize, make sure you have a license before trying to run tests!"); |
| 29 | // Open an empty binary and make sure it succeeds. |
| 30 | let view = BinaryView::from_data(&FileMetadata::new(), &[]); |
| 31 | assert!( |
| 32 | view.is_ok(), |
| 33 | "Failed to open empty binary, core initialization failed!" |
| 34 | ); |
| 35 | shutdown(); |
| 36 | } |
nothing calls this directly
no test coverage detected