should be inclusive (#904)

* should be inclusive

* changed tests due to spans being different
This commit is contained in:
Darren Schroeder 2022-01-31 17:02:36 -06:00 committed by GitHub
parent 4c9df9c7c1
commit c80a15cdfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 13 deletions

View file

@ -50,26 +50,17 @@ impl Command for SubCommand {
Example { Example {
description: "Format a given date using the given format string.", description: "Format a given date using the given format string.",
example: "date format '%Y-%m-%d'", example: "date format '%Y-%m-%d'",
result: Some(Value::String { result: None,
val: Local::now().format("%Y-%m-%d").to_string(),
span: Span::test_data(),
}),
}, },
Example { Example {
description: "Format a given date using the given format string.", description: "Format a given date using the given format string.",
example: r#"date format "%Y-%m-%d %H:%M:%S""#, example: r#"date format "%Y-%m-%d %H:%M:%S""#,
result: Some(Value::String { result: None,
val: Local::now().format("%Y-%m-%d %H:%M:%S").to_string(),
span: Span::test_data(),
}),
}, },
Example { Example {
description: "Format a given date using the given format string.", description: "Format a given date using the given format string.",
example: r#""2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d""#, example: r#""2021-10-22 20:00:12 +01:00" | date format "%Y-%m-%d""#,
result: Some(Value::String { result: None,
val: "2021-10-22".into(),
span: Span::test_data(),
}),
}, },
] ]
} }

View file

@ -84,7 +84,7 @@ fn integer(
Some(Ordering::Equal) => Ok(PipelineData::Value(Value::Int { val: min, span }, None)), Some(Ordering::Equal) => Ok(PipelineData::Value(Value::Int { val: min, span }, None)),
_ => { _ => {
let mut thread_rng = thread_rng(); let mut thread_rng = thread_rng();
let result: i64 = thread_rng.gen_range(min..max); let result: i64 = thread_rng.gen_range(min..=max);
Ok(PipelineData::Value(Value::Int { val: result, span }, None)) Ok(PipelineData::Value(Value::Int { val: result, span }, None))
} }