#!/bin/sh
. test/lib.sh

begin "Indents indented text"
scdoc <<EOF | grep ".RS 4" >/dev/null
test(8)

Not indented
	Indented one level
EOF
end 0

begin "Deindents following indented text"
scdoc <<EOF | grep ".RE" >/dev/null
test(8)

Not indented
	Indented one level
Not indented
EOF
end 0

begin "Disallows multi-step indents"
scdoc <<EOF >/dev/null
test(8)

Not indented
	Indented one level
			Indented three levels
Not indented
EOF
end 1

begin "Allows indentation changes > 1 in literal blocks"
scdoc <<EOF >/dev/null
test(8)

This is some code:

\`\`\`
foobar:
                # asdf
\`\`\`
EOF
end 0

begin "Allows multi-step dedents"
scdoc <<EOF >/dev/null
test(8)

Not indented
	Indented one level
		Indented two levels
Not indented
EOF
end 0

begin "Allows indented literal blocks"
scdoc <<EOF >/dev/null
test(8)

	\`\`\`
	This block is indented.
	\`\`\`
EOF
end 0

begin "Disallows dedenting in literal blocks"
scdoc <<EOF >/dev/null
test(8)

		\`\`\`
		This block is indented.
	This line is dedented past the start of the block.
		\`\`\`
EOF
end 1
