git.delta.rocks / jrsonnet / refs/commits / 8bc6498a805d

difftreelog

source

crates/jrsonnet-formatter/src/tests.rs655 Bsourcehistory
1#![cfg(test)]23use std::fs;45use dprint_core::formatting::{PrintItems, PrintOptions};6use indoc::indoc;7use insta::{assert_snapshot, glob};89use crate::Printable;1011fn reformat(input: &str) -> String {12	let (source, _) = jrsonnet_rowan_parser::parse(input);1314	dprint_core::formatting::format(15		|| {16			let mut out = PrintItems::new();17			source.print(&mut out);18			out19		},20		PrintOptions {21			indent_width: 3,22			max_width: 100,23			use_tabs: false,24			new_line_text: "\n",25		},26	)27}2829#[test]30fn snapshots() {31	glob!("tests/*.jsonnet", |path| {32		let input = fs::read_to_string(path).expect("read test file");33		assert_snapshot!(reformat(&input));34	});35}