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
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
use difference::assert_diff;
use itertools::Itertools;
use libcst_native::{parse_module, prettify_error, Codegen};
use std::{
iter::once,
path::{Component, PathBuf},
};
fn all_fixtures() -> impl Iterator<Item = (PathBuf, String)> {
let mut path = PathBuf::from(file!());
path.pop();
path = path
.components()
.skip(1)
.chain(once(Component::Normal("fixtures".as_ref())))
.collect();
path.read_dir().expect("read_dir").into_iter().map(|file| {
let path = file.unwrap().path();
let contents = std::fs::read_to_string(&path).expect("reading file");
(path, contents)
})
}
fn visualize(s: &str) -> String {
s.replace(' ', "▩").lines().join("↩\n")
}
|