Skip to content

Commit

Permalink
toml test
Browse files Browse the repository at this point in the history
  • Loading branch information
mgree committed Jun 19, 2021
1 parent 8371007 commit 476f3a1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/basic_toml.sh
@@ -0,0 +1,31 @@
#!/bin/sh

fail() {
echo FAILED: $1
if [ "$MNT" ]
then
cd
umount "$MNT"
rmdir "$MNT"
fi
exit 1
}

MNT=$(mktemp -d)

ffs "$MNT" ../toml/eg.toml &
PID=$!
sleep 2
case $(ls "$MNT") in
(clients*database*owner*servers*title) ;;
(*) fail ls;;
esac
[ "$(cat $MNT/title)" = "TOML Example" ] || fail title
[ "$(cat $MNT/owner/dob)" = "1979-05-27T07:32:00-08:00" ] || fail dob

umount "$MNT" || fail unmount
sleep 1

kill -0 $PID >/dev/null 2>&1 && fail process

rmdir "$MNT" || fail mount
1 change: 1 addition & 0 deletions toml/.gitignore
@@ -0,0 +1 @@
mnt
33 changes: 33 additions & 0 deletions toml/eg.toml
@@ -0,0 +1,33 @@
# This is a TOML document.

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00 # First class dates

[database]
server = "192.168.1.1"
ports = [ 8000, 8001, 8002 ]
connection_max = 5000
enabled = true

[servers]

# Indentation (tabs and/or spaces) is allowed but not required
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"

[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"

[clients]
data = [ ["gamma", "delta"], [1, 2] ]

# Line breaks are OK when inside arrays
hosts = [
"alpha",
"omega"
]

0 comments on commit 476f3a1

Please sign in to comment.