Add path for time::epoch constant (#4773)

This commit is contained in:
Dave MacLeod 2024-09-16 15:30:13 +09:00 committed by GitHub
parent be24734048
commit 065ac9cd5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -458,6 +458,7 @@ pub(crate) static PATHS: phf::Map<UniCase<&'static str>, PathKind> = phf_map! {
UniCase::ascii("math::PI") => PathKind::Constant(Constant::MathPi), UniCase::ascii("math::PI") => PathKind::Constant(Constant::MathPi),
UniCase::ascii("math::SQRT_2") => PathKind::Constant(Constant::MathSqrt2), UniCase::ascii("math::SQRT_2") => PathKind::Constant(Constant::MathSqrt2),
UniCase::ascii("math::TAU") => PathKind::Constant(Constant::MathTau), UniCase::ascii("math::TAU") => PathKind::Constant(Constant::MathTau),
UniCase::ascii("time::EPOCH") => PathKind::Constant(Constant::TimeEpoch)
}; };
impl Parser<'_> { impl Parser<'_> {

View file

@ -144,6 +144,9 @@ fn constant_lowercase() {
let out = test_parse!(parse_value_table, r#" math::neg_inf "#).unwrap(); let out = test_parse!(parse_value_table, r#" math::neg_inf "#).unwrap();
assert_eq!(out, Value::Constant(Constant::MathNegInf)); assert_eq!(out, Value::Constant(Constant::MathNegInf));
let out = test_parse!(parse_value_table, r#" time::epoch "#).unwrap();
assert_eq!(out, Value::Constant(Constant::TimeEpoch));
} }
#[test] #[test]
@ -156,6 +159,9 @@ fn constant_uppercase() {
let out = test_parse!(parse_value_table, r#" MATH::NEG_INF "#).unwrap(); let out = test_parse!(parse_value_table, r#" MATH::NEG_INF "#).unwrap();
assert_eq!(out, Value::Constant(Constant::MathNegInf)); assert_eq!(out, Value::Constant(Constant::MathNegInf));
let out = test_parse!(parse_value_table, r#" TIME::EPOCH "#).unwrap();
assert_eq!(out, Value::Constant(Constant::TimeEpoch));
} }
#[test] #[test]
@ -168,6 +174,9 @@ fn constant_mixedcase() {
let out = test_parse!(parse_value_table, r#" MaTh::Neg_Inf "#).unwrap(); let out = test_parse!(parse_value_table, r#" MaTh::Neg_Inf "#).unwrap();
assert_eq!(out, Value::Constant(Constant::MathNegInf)); assert_eq!(out, Value::Constant(Constant::MathNegInf));
let out = test_parse!(parse_value_table, r#" TiME::ePoCH "#).unwrap();
assert_eq!(out, Value::Constant(Constant::TimeEpoch));
} }
#[test] #[test]