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
--- a/cmds/jrsonnet-fmt/src/snapshots/jrsonnet_fmt__tests__complex_comments_snapshot.snap
+++ b/cmds/jrsonnet-fmt/src/snapshots/jrsonnet_fmt__tests__complex_comments_snapshot.snap
@@ -3,51 +3,51 @@
 expression: "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        }\"))"
 ---
 {
-  comments: {
-    _: '',
-    // Plain comment
-    a: '',
+	comments: {
+		_: '',
+		// Plain comment
+		a: '',
 
-    # Plain comment with empty line before
-    b: '',
-    /* Single-line multiline comment */
-    c: '',
+		# Plain comment with empty line before
+		b: '',
+		/* Single-line multiline comment */
+		c: '',
 
-    /**
-     * Single-line multiline doc comment
-     */
-    c: '',
+		/**
+		 * Single-line multiline doc comment
+		 */
+		c: '',
 
-    /**
-     * Multiline doc
-     * Comment
-     */
-    c: '',
+		/**
+		 * Multiline doc
+		 * Comment
+		 */
+		c: '',
 
-    /*
-    Multi-line
+		/*
+		Multi-line
 
-    comment
-    */
-    d: '',
+		comment
+		*/
+		d: '',
 
-    e: '', // Inline comment
+		e: '', // Inline comment
 
-    k: '',
+		k: '',
 
-    // Text after everything
-  },
-  comments2: {
-    k: '',
-    // Text after everything, but no newline above
-  },
-  spacing: {
-    a: '',
+		// Text after everything
+	},
+	comments2: {
+		k: '',
+		// Text after everything, but no newline above
+	},
+	spacing: {
+		a: '',
 
-    b: '',
-  },
-  noSpacing: {
-    a: '',
-    b: '',
-  },
+		b: '',
+	},
+	noSpacing: {
+		a: '',
+		b: '',
+	},
 }
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
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -87,6 +87,7 @@
 	debug: DebugOpts,
 }
 
+// TODO: Add unix_sigpipe = "sig_dfl"
 fn main() {
 	let opts: Opts = Opts::parse();
 
modifiedcrates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stdlib/format.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/format.rs
@@ -88,13 +88,13 @@
 	}
 
 	#[test]
-	#[should_panic]
+	#[should_panic = "TruncatedFormatCode"]
 	fn parse_key_missing_start() {
 		try_parse_mapping_key("").unwrap();
 	}
 
 	#[test]
-	#[should_panic]
+	#[should_panic = "TruncatedFormatCode"]
 	fn parse_key_missing_end() {
 		try_parse_mapping_key("(   ").unwrap();
 	}
modifiedcrates/jrsonnet-rowan-parser/src/tests.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/tests.rs
+++ b/crates/jrsonnet-rowan-parser/src/tests.rs
@@ -248,6 +248,7 @@
 fn eval_simple() {
 	let src = "local a = 1, b = 2; a + local c = 1; c";
 	let (node, errors) = parse(src);
+	assert!(errors.is_empty());
 
 	dbg!(node);
 }
modifiedtests/tests/common.rsdiffbeforeafterboth
--- a/tests/tests/common.rs
+++ b/tests/tests/common.rs
@@ -64,12 +64,12 @@
 		FuncVal::StaticBuiltin(b) => b
 			.params()
 			.iter()
-			.map(|p| p.name().as_str().unwrap_or(&"<unnamed>").to_string())
+			.map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())
 			.collect(),
 		FuncVal::Builtin(b) => b
 			.params()
 			.iter()
-			.map(|p| p.name().as_str().unwrap_or(&"<unnamed>").to_string())
+			.map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())
 			.collect(),
 	}
 }