Rust 1.85, edition=2024 (#15741)

This commit is contained in:
Jack Wright
2025-05-13 07:49:30 -07:00
committed by GitHub
parent 1a0986903f
commit c2ac8f730e
793 changed files with 4276 additions and 3687 deletions

View File

@ -3,19 +3,20 @@ mod from;
mod to;
pub use from::from_nuon;
pub use to::to_nuon;
pub use to::ToStyle;
pub use to::to_nuon;
#[cfg(test)]
mod tests {
use chrono::DateTime;
use nu_protocol::{
BlockId, IntRange, Range, Span, Value,
ast::{CellPath, PathMember, RangeInclusion},
engine::{Closure, EngineState},
record, BlockId, IntRange, Range, Span, Value,
record,
};
use crate::{from_nuon, to_nuon, ToStyle};
use crate::{ToStyle, from_nuon, to_nuon};
/// test something of the form
/// ```nushell
@ -180,19 +181,21 @@ mod tests {
fn to_nuon_errs_on_closure() {
let engine_state = EngineState::new();
assert!(to_nuon(
&engine_state,
&Value::test_closure(Closure {
block_id: BlockId::new(0),
captures: vec![]
}),
ToStyle::Default,
None,
false,
)
.unwrap_err()
.to_string()
.contains("Unsupported input"));
assert!(
to_nuon(
&engine_state,
&Value::test_closure(Closure {
block_id: BlockId::new(0),
captures: vec![]
}),
ToStyle::Default,
None,
false,
)
.unwrap_err()
.to_string()
.contains("Unsupported input")
);
}
#[test]
@ -325,29 +328,31 @@ mod tests {
fn to_nuon_converts_columns_with_spaces() {
let engine_state = EngineState::new();
assert!(from_nuon(
&to_nuon(
&engine_state,
&Value::test_list(vec![
Value::test_record(record!(
"a" => Value::test_int(1),
"b" => Value::test_int(2),
"c d" => Value::test_int(3)
)),
Value::test_record(record!(
"a" => Value::test_int(4),
"b" => Value::test_int(5),
"c d" => Value::test_int(6)
))
]),
ToStyle::Default,
assert!(
from_nuon(
&to_nuon(
&engine_state,
&Value::test_list(vec![
Value::test_record(record!(
"a" => Value::test_int(1),
"b" => Value::test_int(2),
"c d" => Value::test_int(3)
)),
Value::test_record(record!(
"a" => Value::test_int(4),
"b" => Value::test_int(5),
"c d" => Value::test_int(6)
))
]),
ToStyle::Default,
None,
false,
)
.unwrap(),
None,
false,
)
.unwrap(),
None,
)
.is_ok());
.is_ok()
);
}
#[test]
@ -485,10 +490,12 @@ mod tests {
// }
// ```
fn read_code_should_fail_rather_than_panic() {
assert!(from_nuon(
include_str!("../../../tests/fixtures/formats/code.nu"),
None,
)
.is_err());
assert!(
from_nuon(
include_str!("../../../tests/fixtures/formats/code.nu"),
None,
)
.is_err()
);
}
}