git.delta.rocks / jrsonnet / refs/heads / master

difftreelog

source

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