difftreelog
test fix
in: master
6 files changed
cmds/jrsonnet-fmt/src/snapshots/jrsonnet_fmt__tests__complex_comments_snapshot.snapdiffbeforeafterboth3expression: "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 comment9 a: '',9 a: '',101011 # Plain comment with empty line before11 # Plain comment with empty line before12 b: '',12 b: '',13 /* Single-line multiline comment */13 /* Single-line multiline comment */14 c: '',14 c: '',151516 /**16 /**17 * Single-line multiline doc comment17 * Single-line multiline doc comment18 */18 */19 c: '',19 c: '',202021 /**21 /**22 * Multiline doc22 * Multiline doc23 * Comment23 * Comment24 */24 */25 c: '',25 c: '',262627 /*27 /*28 Multi-line28 Multi-line292930 comment30 comment31 */31 */32 d: '',32 d: '',333334 e: '', // Inline comment34 e: '', // Inline comment353536 k: '',36 k: '',373738 // Text after everything38 // Text after everything39 },39 },40 comments2: {40 comments2: {41 k: '',41 k: '',42 // Text after everything, but no newline above42 // Text after everything, but no newline above43 },43 },44 spacing: {44 spacing: {45 a: '',45 a: '',464647 b: '',47 b: '',48 },48 },49 noSpacing: {49 noSpacing: {50 a: '',50 a: '',51 b: '',51 b: '',52 },52 },53}53}5454cmds/jrsonnet-fmt/src/tests.rsdiffbeforeafterboth--- a/cmds/jrsonnet-fmt/src/tests.rs
+++ b/cmds/jrsonnet-fmt/src/tests.rs
@@ -1,4 +1,4 @@
-use dprint_core::formatting::PrintOptions;
+use dprint_core::formatting::{PrintOptions, PrintItems};
use indoc::indoc;
use crate::Printable;
@@ -7,11 +7,15 @@
let (source, _) = jrsonnet_rowan_parser::parse(input);
dprint_core::formatting::format(
- || source.print(),
+ || {
+ let mut out = PrintItems::new();
+ source.print(&mut out);
+ out
+ },
PrintOptions {
indent_width: 2,
max_width: 100,
- use_tabs: false,
+ use_tabs: true,
new_line_text: "\n",
},
)
cmds/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();
crates/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();
}
crates/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);
}
tests/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(),
}
}