File: lsif.rs

package info (click to toggle)
rust-ls-types 0.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 680 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[test]
#[cfg(unix)]
fn run() {
    use ls_types::lsif::Entry;

    let jsonl = include_str!("tsc-unix.lsif");
    for json in jsonl.lines() {
        let entry =
            serde_json::from_str::<Entry>(json).unwrap_or_else(|_| panic!("can not parse {json}"));
        let serialized =
            serde_json::to_string(&entry).unwrap_or_else(|_| panic!("can not serialize {json}"));

        assert_eq!(
            serde_json::from_str::<serde_json::Value>(&serialized).unwrap(),
            serde_json::from_str::<serde_json::Value>(json).unwrap(),
            "and strings:\ntheir: {json}\n  our: {serialized}",
        );
    }
}