1use dprint_core::formatting::{PrintOptions, PrintItems};2use indoc::indoc;34use crate::Printable;56fn reformat(input: &str) -> String {7 let (source, _) = jrsonnet_rowan_parser::parse(input);89 dprint_core::formatting::format(10 || {11 let mut out = PrintItems::new();12 source.print(&mut out);13 out14 },15 PrintOptions {16 indent_width: 2,17 max_width: 100,18 use_tabs: true,19 new_line_text: "\n",20 },21 )22}2324#[test]25fn complex_comments_snapshot() {26 insta::assert_display_snapshot!(reformat(indoc!(27 "{28 comments: {29 _: '',30 // Plain comment31 a: '',3233 # Plain comment with empty line before34 b: '',35 /*Single-line multiline comment3637 */38 c: '',3940 /**Single-line multiline doc comment4142 */43 c: '',4445 /**Multiline doc46 Comment47 */48 c: '',4950 /*5152 Multi-line5354 comment55 */56 d: '',5758 e: '', // Inline comment5960 k: '',6162 // Text after everything63 },64 comments2: {65 k: '',66 // Text after everything, but no newline above67 },68 spacing: {69 a: '',7071 b: '',72 },73 noSpacing: {74 a: '',75 b: '',76 },77 }"78 )))79}