File: warnings.rs

package info (click to toggle)
rust-simplecss 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220 kB
  • sloc: makefile: 2
file content (45 lines) | stat: -rw-r--r-- 989 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2019 the SimpleCSS Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Warnings

fn run_process(input: &str) -> String {
    use std::io::Write;
    use std::process::Stdio;

    let mut child = std::process::Command::new("target/debug/examples/parse")
        .arg("-")
        .stdin(Stdio::piped())
        .stdout(Stdio::null())
        .stderr(Stdio::piped())
        .spawn()
        .unwrap();

    child
        .stdin
        .as_mut()
        .unwrap()
        .write_all(input.as_bytes())
        .unwrap();

    let output = child.wait_with_output().expect("Failed to read stdout");
    String::from_utf8(output.stderr).unwrap()
}

#[test]
#[ignore]
fn style_01() {
    assert_eq!(
        run_process("> {}"),
        "WARN: Selector parsing failed cause unexpected combinator.\n"
    );
}

#[test]
#[ignore]
fn style_02() {
    assert_eq!(
        run_process("@import 'subs.css';"),
        "WARN: The @import rule is not supported. Skipped.\n"
    );
}