summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2017-06-01 17:51:02 +0200
committerUrban Müller2017-06-01 17:51:02 +0200
commit9e266afd380229e578c1b4dc2e32b5506dd99e57 (patch)
tree7c44e6d6f8be44909e8d66a4f0a5804f9bf02a7b
parent6a62ac385b25602496daf445ab9a7185cae1948b (diff)
downloaditools-9e266afd380229e578c1b4dc2e32b5506dd99e57.tar.gz
itools-9e266afd380229e578c1b4dc2e32b5506dd99e57.tar.bz2
itools-9e266afd380229e578c1b4dc2e32b5506dd99e57.zip
tests for it::filter
-rw-r--r--it.class1
-rwxr-xr-xtests/it.t4
2 files changed, 4 insertions, 1 deletions
diff --git a/it.class b/it.class
index 410a1c0..3e83081 100644
--- a/it.class
+++ b/it.class
@@ -555,7 +555,6 @@ static function filter_keys($array, $keys, $p = array())
return $result;
}
-
/**
* Construct shell command using it::shell_command, log it, execute it and return output as string.
* {keyword} quotes and inserts value from assoc array like ET()
diff --git a/tests/it.t b/tests/it.t
index 77bab72..8d840ef 100755
--- a/tests/it.t
+++ b/tests/it.t
@@ -439,6 +439,10 @@ is(it::map('2*$v', [3, 4, 5], ['keys' => '0,1']), [6, 8, 5]);
is(it::map('2*$v', [3, 4, 5], ['keys' => [0,1]]), [6, 8, 5]);
is(it::map('2*$v', ['foo' => 1, 'bar' => 2], ['keys' => 'foo']), ['foo' => 2, 'bar' => 2]);
+# it::filter
+is(it::filter('$v > 2', [1, 5 => 2, 2 => 3]), [2 => 3]);
+is(it::filter('$k > 2', [1, 5 => 2, 2 => 3]), [5 => 2]);
+
is(it::add_dir("foo/bar"), "foo/37/bar");
is(it::add_dir("baz/bar"), "baz/37/bar");
is(it::add_dir("bar"), "./37/bar");