Fix tests and packages for all features.
This commit is contained in:
parent
d3a97dc86b
commit
41366d08fe
@ -12,12 +12,10 @@ use crate::stdlib::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn map_get_keys(map: &mut Map) -> Vec<Dynamic> {
|
fn map_get_keys(map: &mut Map) -> Vec<Dynamic> {
|
||||||
map.iter()
|
map.iter().map(|(k, _)| k.to_string().into()).collect()
|
||||||
.map(|(k, _)| k.to_string().into())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
}
|
}
|
||||||
fn map_get_values(map: &mut Map) -> Vec<Dynamic> {
|
fn map_get_values(map: &mut Map) -> Vec<Dynamic> {
|
||||||
map.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>()
|
map.iter().map(|(_, v)| v.clone()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "no_object"))]
|
#[cfg(not(feature = "no_object"))]
|
||||||
|
@ -37,7 +37,7 @@ fn sub_string(s: &mut String, start: INT, len: INT) -> String {
|
|||||||
len as usize
|
len as usize
|
||||||
};
|
};
|
||||||
|
|
||||||
chars[offset..][..len].into_iter().collect::<String>()
|
chars[offset..][..len].into_iter().collect()
|
||||||
}
|
}
|
||||||
fn crop_string(s: &mut String, start: INT, len: INT) {
|
fn crop_string(s: &mut String, start: INT, len: INT) {
|
||||||
let offset = if s.is_empty() || len <= 0 {
|
let offset = if s.is_empty() || len <= 0 {
|
||||||
|
@ -87,10 +87,10 @@ def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
|
|||||||
#[cfg(not(feature = "unchecked"))]
|
#[cfg(not(feature = "unchecked"))]
|
||||||
{
|
{
|
||||||
if seconds > (MAX_INT as u64) {
|
if seconds > (MAX_INT as u64) {
|
||||||
return Err(EvalAltResult::ErrorArithmetic(
|
return Err(Box::new(EvalAltResult::ErrorArithmetic(
|
||||||
format!("Integer overflow for timestamp.elapsed(): {}", seconds),
|
format!("Integer overflow for timestamp.elapsed(): {}", seconds),
|
||||||
Position::none(),
|
Position::none(),
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Ok(seconds as INT);
|
return Ok(seconds as INT);
|
||||||
|
@ -143,6 +143,7 @@ fn test_map_return() -> Result<(), Box<EvalAltResult>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(feature = "no_index"))]
|
||||||
fn test_map_for() -> Result<(), Box<EvalAltResult>> {
|
fn test_map_for() -> Result<(), Box<EvalAltResult>> {
|
||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user