Skip to content

Commit

Permalink
Updated integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Jan 1, 2024
1 parent 87eb002 commit 4c9e946
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/mdsplode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,40 @@ mdsplode --input "$MD_FILE" \
--query '.children.nodes[] | select(.name == "toml") | .json' | \
jq -r . | jq .frontmatter
echo

header "Process markdown to file ($TMP_DIR/out.json)"
mkdir -p $TMP_DIR
mdsplode --input "$MD_FILE" --output "$TMP_DIR/out.json"
echo

header "Read from $TMP_DIR/out.json"
cat "$TMP_DIR/out.json"
echo
echo

header "Process again to same markdown file ($TMP_DIR/out.json)"
mdsplode --input "$MD_FILE" --output "$TMP_DIR/out.json"
echo

header "Re-read from $TMP_DIR/out.json"
cat "$TMP_DIR/out.json"
echo
echo

header "Skip processing, read from $TMP_DIR/out.json, and apply query"
mdsplode --skip-process --input "$TMP_DIR/out.json" \
--query '.children.nodes[] | select((.depth == 3) and .name == "heading") | .children.nodes[].source'
echo

header "Process multiple markdown files ($MD_DIR/)"
rm -rf $TMP_DIR/many-md-files
mkdir -p $TMP_DIR/many-md-files
mdsplode --input "$MD_DIR" --output "$TMP_DIR/many-md-files"
find $TMP_DIR/many-md-files -type f -ls
echo

header "View title from each of the multiple files"
mdsplode --skip-process --input "$TMP_DIR/many-md-files" --log-level info \
--query '.children.nodes[] | select(.name == "toml") | .json' | \
tr ',' '\n'|egrep -e '"title|INFO'
echo

0 comments on commit 4c9e946

Please sign in to comment.