notea-de-me/app/crawler/notnotea_test.sh

19 lines
418 B
Bash

#! /bin/bash
test__recurse_ids() {
local two_levels='{
"Branches": {
"id": {
"Branches": {
"subid": {
"Branches": {}
}
}
}
}
}'
(notnotea _recurse_ids "" "$two_levels"; true) | grep -q '^id$' || return 101
(notnotea _recurse_ids "" "$two_levels"; true) | tail -n 1 | grep -q '^id\/subid$' || return 102
notnotea _recurse_ids "" "$two_levels" | wc -l | grep -q 2 || return 103
}