git.delta.rocks / jrsonnet / refs/commits / 000d927bc641

difftreelog

test fix

Yaroslav Bolyukin2024-03-03parent: #0764805.patch.diff
in: master

6 files changed

modifiedcmds/jrsonnet-fmt/src/snapshots/jrsonnet_fmt__tests__complex_comments_snapshot.snapdiffbeforeafterboth
3expression: "reformat(indoc!(\"{\n\t\t comments: {\n\t\t\t_: '',\n\t\t\t// Plain comment\n\t\t\ta: '',\n\n\t\t\t# Plain comment with empty line before\n\t\t\tb: '',\n\t\t\t/*Single-line multiline comment\n\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/**Single-line multiline doc comment\n\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/**Multiline doc\n\t\t\tComment\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/*\n\n\tMulti-line\n\n\tcomment\n\t\t\t*/\n\t\t\td: '',\n\n\t\t\te: '', // Inline comment\n\n\t\t\tk: '',\n\n\t\t\t// Text after everything\n\t\t },\n\t\t comments2: {\n\t\t\tk: '',\n\t\t\t// Text after everything, but no newline above\n\t\t },\n spacing: {\n a: '',\n\n b: '',\n },\n noSpacing: {\n a: '',\n b: '',\n },\n }\"))"3expression: "reformat(indoc!(\"{\n\t\t comments: {\n\t\t\t_: '',\n\t\t\t// Plain comment\n\t\t\ta: '',\n\n\t\t\t# Plain comment with empty line before\n\t\t\tb: '',\n\t\t\t/*Single-line multiline comment\n\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/**Single-line multiline doc comment\n\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/**Multiline doc\n\t\t\tComment\n\t\t\t*/\n\t\t\tc: '',\n\n\t\t\t/*\n\n\tMulti-line\n\n\tcomment\n\t\t\t*/\n\t\t\td: '',\n\n\t\t\te: '', // Inline comment\n\n\t\t\tk: '',\n\n\t\t\t// Text after everything\n\t\t },\n\t\t comments2: {\n\t\t\tk: '',\n\t\t\t// Text after everything, but no newline above\n\t\t },\n spacing: {\n a: '',\n\n b: '',\n },\n noSpacing: {\n a: '',\n b: '',\n },\n }\"))"
4---4---
5{5{
6 comments: {6 comments: {
7 _: '',7 _: '',
8 // Plain comment8 // Plain comment
9 a: '',9 a: '',
1010
11 # Plain comment with empty line before11 # Plain comment with empty line before
12 b: '',12 b: '',
13 /* Single-line multiline comment */13 /* Single-line multiline comment */
14 c: '',14 c: '',
1515
16 /**16 /**
17 * Single-line multiline doc comment17 * Single-line multiline doc comment
18 */18 */
19 c: '',19 c: '',
2020
21 /**21 /**
22 * Multiline doc22 * Multiline doc
23 * Comment23 * Comment
24 */24 */
25 c: '',25 c: '',
2626
27 /*27 /*
28 Multi-line28 Multi-line
2929
30 comment30 comment
31 */31 */
32 d: '',32 d: '',
3333
34 e: '', // Inline comment34 e: '', // Inline comment
3535
36 k: '',36 k: '',
3737
38 // Text after everything38 // Text after everything
39 },39 },
40 comments2: {40 comments2: {
41 k: '',41 k: '',
42 // Text after everything, but no newline above42 // Text after everything, but no newline above
43 },43 },
44 spacing: {44 spacing: {
45 a: '',45 a: '',
4646
47 b: '',47 b: '',
48 },48 },
49 noSpacing: {49 noSpacing: {
50 a: '',50 a: '',
51 b: '',51 b: '',
52 },52 },
53}53}
5454
modifiedcmds/jrsonnet-fmt/src/tests.rsdiffbeforeafterboth
1use dprint_core::formatting::PrintOptions;1use dprint_core::formatting::{PrintOptions, PrintItems};
2use indoc::indoc;2use indoc::indoc;
33
4use crate::Printable;4use crate::Printable;
7 let (source, _) = jrsonnet_rowan_parser::parse(input);7 let (source, _) = jrsonnet_rowan_parser::parse(input);
88
9 dprint_core::formatting::format(9 dprint_core::formatting::format(
10 || source.print(),10 || {
11 let mut out = PrintItems::new();
12 source.print(&mut out);
13 out
14 },
11 PrintOptions {15 PrintOptions {
12 indent_width: 2,16 indent_width: 2,
13 max_width: 100,17 max_width: 100,
14 use_tabs: false,18 use_tabs: true,
15 new_line_text: "\n",19 new_line_text: "\n",
16 },20 },
17 )21 )
modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
87 debug: DebugOpts,87 debug: DebugOpts,
88}88}
8989
90// TODO: Add unix_sigpipe = "sig_dfl"
90fn main() {91fn main() {
91 let opts: Opts = Opts::parse();92 let opts: Opts = Opts::parse();
9293
modifiedcrates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth
88 }88 }
8989
90 #[test]90 #[test]
91 #[should_panic]91 #[should_panic = "TruncatedFormatCode"]
92 fn parse_key_missing_start() {92 fn parse_key_missing_start() {
93 try_parse_mapping_key("").unwrap();93 try_parse_mapping_key("").unwrap();
94 }94 }
9595
96 #[test]96 #[test]
97 #[should_panic]97 #[should_panic = "TruncatedFormatCode"]
98 fn parse_key_missing_end() {98 fn parse_key_missing_end() {
99 try_parse_mapping_key("( ").unwrap();99 try_parse_mapping_key("( ").unwrap();
100 }100 }
modifiedcrates/jrsonnet-rowan-parser/src/tests.rsdiffbeforeafterboth
248fn eval_simple() {248fn eval_simple() {
249 let src = "local a = 1, b = 2; a + local c = 1; c";249 let src = "local a = 1, b = 2; a + local c = 1; c";
250 let (node, errors) = parse(src);250 let (node, errors) = parse(src);
251 assert!(errors.is_empty());
251252
252 dbg!(node);253 dbg!(node);
253}254}
modifiedtests/tests/common.rsdiffbeforeafterboth
64 FuncVal::StaticBuiltin(b) => b64 FuncVal::StaticBuiltin(b) => b
65 .params()65 .params()
66 .iter()66 .iter()
67 .map(|p| p.name().as_str().unwrap_or(&"<unnamed>").to_string())67 .map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())
68 .collect(),68 .collect(),
69 FuncVal::Builtin(b) => b69 FuncVal::Builtin(b) => b
70 .params()70 .params()
71 .iter()71 .iter()
72 .map(|p| p.name().as_str().unwrap_or(&"<unnamed>").to_string())72 .map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())
73 .collect(),73 .collect(),
74 }74 }
75}75}