1fad3a1d3Sopenharmony_ci#![cfg(syn_disable_nightly_tests)]
2fad3a1d3Sopenharmony_ci
3fad3a1d3Sopenharmony_ciuse std::io::{self, Write};
4fad3a1d3Sopenharmony_ciuse termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
5fad3a1d3Sopenharmony_ci
6fad3a1d3Sopenharmony_ciconst MSG: &str = "\
7fad3a1d3Sopenharmony_ci8fad3a1d3Sopenharmony_ciWARNING:
9fad3a1d3Sopenharmony_ciThis is not a nightly compiler so not all tests were able to
10fad3a1d3Sopenharmony_cirun. Syn includes tests that compare Syn's parser against the
11fad3a1d3Sopenharmony_cicompiler's parser, which requires access to unstable librustc
12fad3a1d3Sopenharmony_cidata structures and a nightly compiler.
13fad3a1d3Sopenharmony_ci14fad3a1d3Sopenharmony_ci";
15fad3a1d3Sopenharmony_ci
16fad3a1d3Sopenharmony_ci#[test]
17fad3a1d3Sopenharmony_cifn notice() -> io::Result<()> {
18fad3a1d3Sopenharmony_ci    let header = "WARNING";
19fad3a1d3Sopenharmony_ci    let index_of_header = MSG.find(header).unwrap();
20fad3a1d3Sopenharmony_ci    let before = &MSG[..index_of_header];
21fad3a1d3Sopenharmony_ci    let after = &MSG[index_of_header + header.len()..];
22fad3a1d3Sopenharmony_ci
23fad3a1d3Sopenharmony_ci    let mut stderr = StandardStream::stderr(ColorChoice::Auto);
24fad3a1d3Sopenharmony_ci    stderr.set_color(ColorSpec::new().set_fg(Some(Color::Yellow)))?;
25fad3a1d3Sopenharmony_ci    write!(&mut stderr, "{}", before)?;
26fad3a1d3Sopenharmony_ci    stderr.set_color(ColorSpec::new().set_bold(true).set_fg(Some(Color::Yellow)))?;
27fad3a1d3Sopenharmony_ci    write!(&mut stderr, "{}", header)?;
28fad3a1d3Sopenharmony_ci    stderr.set_color(ColorSpec::new().set_fg(Some(Color::Yellow)))?;
29fad3a1d3Sopenharmony_ci    write!(&mut stderr, "{}", after)?;
30fad3a1d3Sopenharmony_ci    stderr.reset()?;
31fad3a1d3Sopenharmony_ci
32fad3a1d3Sopenharmony_ci    Ok(())
33fad3a1d3Sopenharmony_ci}
34