test(xatu): format inline fixtures
This commit is contained in:
@@ -14,7 +14,11 @@ fn source_file(path: &str, source: &str) -> SourceFile {
|
|||||||
fn future_sight_reports_clean_sources_as_clean() {
|
fn future_sight_reports_clean_sources_as_clean() {
|
||||||
let report = xatu::future_sight(vec![source_file(
|
let report = xatu::future_sight(vec![source_file(
|
||||||
"clean.nix",
|
"clean.nix",
|
||||||
"{ path = ./. + \"/foo\"; inherit foo; }",
|
r#"{
|
||||||
|
path = ./. + "/foo";
|
||||||
|
inherit foo;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
)])
|
)])
|
||||||
.expect("fixture should parse");
|
.expect("fixture should parse");
|
||||||
|
|
||||||
@@ -23,7 +27,7 @@ fn future_sight_reports_clean_sources_as_clean() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn future_sight_rejects_parse_errors() {
|
fn future_sight_rejects_parse_errors() {
|
||||||
let error = xatu::future_sight(vec![source_file("invalid.nix", "{")])
|
let error = xatu::future_sight(vec![source_file("invalid.nix", "{\n")])
|
||||||
.expect_err("fixture should fail to parse");
|
.expect_err("fixture should fail to parse");
|
||||||
|
|
||||||
assert_eq!(error.code(), Code::FailedPrecondition);
|
assert_eq!(error.code(), Code::FailedPrecondition);
|
||||||
@@ -31,8 +35,11 @@ fn future_sight_rejects_parse_errors() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn future_sight_reports_deprecated_to_path_ident_findings() {
|
fn future_sight_reports_deprecated_to_path_ident_findings() {
|
||||||
let report = xatu::future_sight(vec![source_file("deprecated_to_path_ident.nix", "toPath x")])
|
let report = xatu::future_sight(vec![source_file(
|
||||||
.expect("fixture should parse");
|
"deprecated_to_path_ident.nix",
|
||||||
|
"toPath x\n",
|
||||||
|
)])
|
||||||
|
.expect("fixture should parse");
|
||||||
|
|
||||||
assert_eq!(report.diagnostics.len(), 1);
|
assert_eq!(report.diagnostics.len(), 1);
|
||||||
|
|
||||||
@@ -48,7 +55,7 @@ fn future_sight_reports_deprecated_to_path_ident_findings() {
|
|||||||
fn future_sight_reports_deprecated_to_path_select_findings() {
|
fn future_sight_reports_deprecated_to_path_select_findings() {
|
||||||
let report = xatu::future_sight(vec![source_file(
|
let report = xatu::future_sight(vec![source_file(
|
||||||
"deprecated_to_path_select.nix",
|
"deprecated_to_path_select.nix",
|
||||||
"builtins.toPath x",
|
"builtins.toPath x\n",
|
||||||
)])
|
)])
|
||||||
.expect("fixture should parse");
|
.expect("fixture should parse");
|
||||||
|
|
||||||
@@ -64,8 +71,11 @@ fn future_sight_reports_deprecated_to_path_select_findings() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn future_sight_reports_empty_inherit_findings() {
|
fn future_sight_reports_empty_inherit_findings() {
|
||||||
let report = xatu::future_sight(vec![source_file("empty_inherit.nix", "{ inherit; }")])
|
let report = xatu::future_sight(vec![source_file(
|
||||||
.expect("fixture should parse");
|
"empty_inherit.nix",
|
||||||
|
"{\n inherit;\n}\n",
|
||||||
|
)])
|
||||||
|
.expect("fixture should parse");
|
||||||
|
|
||||||
assert_eq!(report.diagnostics.len(), 1);
|
assert_eq!(report.diagnostics.len(), 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user