| 1 | use craterust-analyzer cargo target-lexicon 0.13.3 crate/::{Architecturerust-analyzer cargo target-lexicon 0.13.3 targets/Architecture#, BinaryFormatrust-analyzer cargo target-lexicon 0.13.3 targets/BinaryFormat#, Environmentrust-analyzer cargo target-lexicon 0.13.3 targets/Environment#, OperatingSystemrust-analyzer cargo target-lexicon 0.13.3 targets/OperatingSystem#, Triplerust-analyzer cargo target-lexicon 0.13.3 triple/Triple#, Vendorrust-analyzer cargo target-lexicon 0.13.3 targets/Vendor#}; |
| 2 | |
| 3 | // Include the implementations of the `HOST` object containing information |
| 4 | // about the current host. |
| 5 | includerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include!!(concatrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/concat!!(envrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/env!!("OUT_DIR"), "/host.rs")); |
| 6 | |
| 7 | #[cfg(test)] |
| 8 | mod tests { |
| 9 | #[cfg(target_os = "aix")] |
| 10 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 11 | fn test_aix() { |
| 12 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 13 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(OperatingSystem::host(), OperatingSystem::Aix); |
| 14 | } |
| 15 | |
| 16 | #[cfg(target_os = "cygwin")] |
| 17 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 18 | fn test_cygwin() { |
| 19 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 20 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(OperatingSystem::host(), OperatingSystem::Cygwin); |
| 21 | } |
| 22 | |
| 23 | #[cfg(target_os = "linux")] |
| 24 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 25 | fn test_linux() { |
| 26 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 27 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(OperatingSystem::host(), OperatingSystem::Linux); |
| 28 | } |
| 29 | |
| 30 | #[cfg(target_os = "macos")] |
| 31 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 32 | fn test_macos() { |
| 33 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 34 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(OperatingSystem::host(), OperatingSystem::Darwin(None)); |
| 35 | } |
| 36 | |
| 37 | #[cfg(windows)] |
| 38 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 39 | fn test_windows() { |
| 40 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 41 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(OperatingSystem::host(), OperatingSystem::Windows); |
| 42 | } |
| 43 | |
| 44 | #[cfg(target_pointer_width = "16")] |
| 45 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 46 | fn test_ptr16() { |
| 47 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 48 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Architecture::host().pointer_width().unwrap().bits(), 16); |
| 49 | } |
| 50 | |
| 51 | #[cfg(target_pointer_width = "32")] |
| 52 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 53 | fn test_ptr32() { |
| 54 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 55 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Architecture::host().pointer_width().unwrap().bits(), 32); |
| 56 | } |
| 57 | |
| 58 | #[cfg(target_pointer_width = "64")] |
| 59 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 60 | fn test_ptr64() { |
| 61 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 62 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Architecture::host().pointer_width().unwrap().bits(), 64); |
| 63 | } |
| 64 | |
| 65 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 66 | fn host_object() { |
| 67 | use superrust-analyzer cargo target-lexicon 0.13.3 crate/::*; |
| 68 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(HOST, Triple::host()); |
| 69 | } |
| 70 | } |