]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/format-no-std.rs
Rollup merge of #60685 - dtolnay:spdx, r=nikomatsakis
[rust.git] / src / test / run-pass / format-no-std.rs
1 // ignore-emscripten no no_std executables
2
3 #![feature(lang_items, start)]
4 #![no_std]
5
6 extern crate std as other;
7
8 #[macro_use] extern crate alloc;
9
10 use alloc::string::ToString;
11
12 #[start]
13 fn start(_argc: isize, _argv: *const *const u8) -> isize {
14     let s = format!("{}", 1_isize);
15     assert_eq!(s, "1".to_string());
16
17     let s = format!("test");
18     assert_eq!(s, "test".to_string());
19
20     let s = format!("{test}", test=3_isize);
21     assert_eq!(s, "3".to_string());
22
23     let s = format!("hello {}", "world");
24     assert_eq!(s, "hello world".to_string());
25
26     0
27 }