2020-08-21 16:38:35 +02:00
|
|
|
use super::write_code;
|
2020-08-27 12:50:28 +02:00
|
|
|
use expect_test::expect_file;
|
2020-06-27 19:55:15 +02:00
|
|
|
|
|
|
|
#[test]
|
2020-08-27 12:50:28 +02:00
|
|
|
fn test_html_highlighting() {
|
|
|
|
let src = include_str!("fixtures/sample.rs");
|
|
|
|
let html = {
|
|
|
|
let mut out = String::new();
|
|
|
|
write_code(&mut out, src);
|
|
|
|
format!("{}<pre><code>{}</code></pre>\n", STYLE, out)
|
|
|
|
};
|
2020-08-31 21:04:09 +02:00
|
|
|
expect_file!["fixtures/sample.html"].assert_eq(&html);
|
2020-06-27 19:55:15 +02:00
|
|
|
}
|
|
|
|
|
2020-08-27 12:50:28 +02:00
|
|
|
const STYLE: &str = r#"
|
|
|
|
<style>
|
|
|
|
.kw { color: #8959A8; }
|
|
|
|
.kw-2, .prelude-ty { color: #4271AE; }
|
|
|
|
.number, .string { color: #718C00; }
|
|
|
|
.self, .bool-val, .prelude-val, .attribute, .attribute .ident { color: #C82829; }
|
|
|
|
.macro, .macro-nonterminal { color: #3E999F; }
|
|
|
|
.lifetime { color: #B76514; }
|
|
|
|
.question-mark { color: #ff9011; }
|
|
|
|
</style>
|
|
|
|
"#;
|