Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/semver/tests/test_identifier.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / semver / tests / test_identifier.rs` 51 lines ยท 1428 bytes Raw Blame History 1 #![allow( 2 clippy::eq_op, 3 clippy::needless_pass_by_value, 4 clippy::toplevel_ref_arg, 5 clippy::wildcard_imports 6 )] 7 8 mod util; 9 10 use crate::util::*; 11 use semver::Prerelease; 12 13 #[test] 14 fn test_new() { 15 fn test(identifier: Prerelease, expected: &str) { 16 assert_eq!(identifier.is_empty(), expected.is_empty()); 17 assert_eq!(identifier.len(), expected.len()); 18 assert_eq!(identifier.as_str(), expected); 19 assert_eq!(identifier, identifier); 20 assert_eq!(identifier, identifier.clone()); 21 } 22 23 let ref mut string = String::new(); 24 let limit = if cfg!(miri) { 40 } else { 280 }; // miri is slow 25 for _ in 0..limit { 26 test(prerelease(string), string); 27 string.push('1'); 28 } 29 30 if !cfg!(miri) { 31 let ref string = string.repeat(20000); 32 test(prerelease(string), string); 33 } 34 } 35 36 #[test] 37 fn test_eq() { 38 assert_eq!(prerelease("-"), prerelease("-")); 39 assert_ne!(prerelease("a"), prerelease("aa")); 40 assert_ne!(prerelease("aa"), prerelease("a")); 41 assert_ne!(prerelease("aaaaaaaaa"), prerelease("a")); 42 assert_ne!(prerelease("a"), prerelease("aaaaaaaaa")); 43 assert_ne!(prerelease("aaaaaaaaa"), prerelease("bbbbbbbbb")); 44 assert_ne!(build_metadata("1"), build_metadata("001")); 45 } 46 47 #[test] 48 fn test_prerelease() { 49 let err = prerelease_err("1.b\0"); 50 assert_to_string(err, "unexpected character in pre-release identifier"); 51 }