Fix tests and packages for all features.

This commit is contained in:
Stephen Chung 2020-04-27 22:52:20 +08:00
parent d3a97dc86b
commit 41366d08fe
4 changed files with 6 additions and 7 deletions

View File

@ -12,12 +12,10 @@ use crate::stdlib::{
};
fn map_get_keys(map: &mut Map) -> Vec<Dynamic> {
map.iter()
.map(|(k, _)| k.to_string().into())
.collect::<Vec<_>>()
map.iter().map(|(k, _)| k.to_string().into()).collect()
}
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"))]

View File

@ -37,7 +37,7 @@ fn sub_string(s: &mut String, start: INT, len: INT) -> String {
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) {
let offset = if s.is_empty() || len <= 0 {

View File

@ -87,10 +87,10 @@ def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
#[cfg(not(feature = "unchecked"))]
{
if seconds > (MAX_INT as u64) {
return Err(EvalAltResult::ErrorArithmetic(
return Err(Box::new(EvalAltResult::ErrorArithmetic(
format!("Integer overflow for timestamp.elapsed(): {}", seconds),
Position::none(),
));
)));
}
}
return Ok(seconds as INT);

View File

@ -143,6 +143,7 @@ fn test_map_return() -> Result<(), Box<EvalAltResult>> {
}
#[test]
#[cfg(not(feature = "no_index"))]
fn test_map_for() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();