mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 15:11:52 +02:00
Remove parking_lot crate reference from nu-data (#3091)
* remove parking_lot crate from nu-data as it is no longer being used * remove commented out code from parse.rs * remove commented out code from scope.rs
This commit is contained in:
@ -938,107 +938,6 @@ fn parse_arg(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MockRegistry {}
|
||||
|
||||
impl MockRegistry {
|
||||
fn new() -> Self {
|
||||
MockRegistry {}
|
||||
}
|
||||
}
|
||||
|
||||
impl SignatureRegistry for MockRegistry {
|
||||
fn has(&self, _name: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn get(&self, _name: &str) -> Option<nu_protocol::Signature> {
|
||||
None
|
||||
}
|
||||
|
||||
fn clone_box(&self) -> Box<dyn SignatureRegistry> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn parse_integer() -> Result<(), ParseError> {
|
||||
let raw = "32".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let scope = MockRegistry::new();
|
||||
let result = parse_arg(SyntaxShape::Int, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(result.0.expr, Expression::integer(BigInt::from(32)));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_number() -> Result<(), ParseError> {
|
||||
let scope = MockRegistry::new();
|
||||
|
||||
let raw = "-32.2".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(
|
||||
result.0.expr,
|
||||
Expression::decimal(BigDecimal::new(BigInt::from(-322), 1))
|
||||
);
|
||||
|
||||
let raw = "32.2".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(
|
||||
result.0.expr,
|
||||
Expression::decimal(BigDecimal::new(BigInt::from(322), 1))
|
||||
);
|
||||
|
||||
let raw = "36893488147419103232.54".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(
|
||||
result.0.expr,
|
||||
Expression::decimal(BigDecimal::new(
|
||||
BigInt::from(3689348814741910323254 as i128),
|
||||
2
|
||||
))
|
||||
);
|
||||
|
||||
let raw = "-34".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(result.0.expr, Expression::integer(BigInt::from(-34)));
|
||||
|
||||
let raw = "34".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(result.0.expr, Expression::integer(BigInt::from(34)));
|
||||
|
||||
let raw = "36893488147419103232".to_string();
|
||||
let input = raw.clone().spanned(Span::new(0, raw.len()));
|
||||
let result = parse_arg(SyntaxShape::Number, &scope, &input);
|
||||
assert_eq!(result.1, None);
|
||||
assert_eq!(
|
||||
result.0.expr,
|
||||
Expression::integer(BigInt::from(36893488147419103232 as u128))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
/// Match the available flags in a signature with what the user provided. This will check both long-form flags (--long) and shorthand flags (-l)
|
||||
/// This also allows users to provide a group of shorthand flags (-la) that correspond to multiple shorthand flags at once.
|
||||
fn get_flags_from_flag(
|
||||
|
Reference in New Issue
Block a user