Created
January 30, 2012 09:46
-
-
Save domcleal/1703601 to your computer and use it in GitHub Desktop.
augrun.c test harness, testing puppet bug #12199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tests for aug_srun | |
# Blank lines and lines starting with '#' are ignored. This file is | |
# processed by test-run.c | |
# | |
# The syntax for a test specification is | |
# test NAME RESULT ERRCODE | |
# COMMANDS | |
# prints | |
# OUTPUT | |
# | |
# where | |
# NAME - the name printed to identify the test | |
# RESULT - an integer that is compared against the return code | |
# of aug_srun | |
# ERRCODE - one of the error codes defined in enum errcode_t in augeas.h | |
# without the AUG_ prefix, i.e. NOERROR, EMMATCH etc. If ERRCODE | |
# is ommitted, it defaults to NOERROR | |
# COMMANDS - the commands to hand to aug_srun; can be multiple lines, | |
# which are passed as one string. | |
# OUTPUT - the string that aug_srun should print on the OUT file stream | |
# | |
# The prints keyword and OUTPUT are optional; if they are not provided, the | |
# output of aug_srun must be empty | |
# | |
# Leading spaces are stripped from COMMANDS and OUTPUT; a leading or trailing | |
# ':' is also stripped, but the rest of the line is used verbatim. | |
# | |
# A test passes when RESULT and ERRCODE agree with what aug_srun given | |
# COMMANDS produces, and OUTPUT coincides with what aug_srun prints on its | |
# OUT stream. | |
# | |
# The test is run against a tree initialized with AUG_NO_STDINC|AUG_NO_LOAD | |
# and file system root /dev/null | |
# [ snip ] | |
# Combinations of quotes in values, some unmatched | |
# Tests from David Schmitt (Puppet bug #12199) | |
test quot_sq -1 ECMDRUN | |
set /test ' | |
test quot_sq_sq -1 ECMDRUN | |
set /test ''' | |
test quot_sq_dq 2 | |
set /test "'" | |
get /test | |
prints | |
/test = ' | |
test quot_sqsq 2 | |
set /test '' | |
get /test | |
prints | |
/test = | |
test quot_sqsq_sq 2 | |
set /test '''' | |
get /test | |
prints | |
/test = | |
test quot_sqsq_dq 2 | |
set /test "''" | |
get /test | |
prints | |
/test = '' | |
test quot_sqsqsq -1 ECMDRUN | |
set /test ''' | |
test quot_sqsqsq_sq -1 ECMDRUN | |
set /test ''''' | |
test quot_sqsqsq_dq 2 | |
set /test "'''" | |
get /test | |
prints | |
/test = ''' | |
test quot_sqsqsqsq 2 | |
set /test '''' | |
get /test | |
prints | |
/test = | |
test quot_sqsqsqsq_sq 2 | |
set /test '''''' | |
get /test | |
prints | |
/test = | |
test quot_sqsqsqsq_dq 2 | |
set /test "''''" | |
get /test | |
prints | |
/test = '''' | |
test quot_dq -1 ECMDRUN | |
set /test " | |
test quot_dq_sq 2 | |
set /test '"' | |
get /test | |
prints | |
/test = " | |
test quot_dq_dq -1 ECMDRUN | |
set /test """ | |
test quot_dqdq 2 | |
set /test "" | |
get /test | |
prints | |
/test = | |
test quot_dqdq_sq 2 | |
set /test '""' | |
get /test | |
prints | |
/test = "" | |
test quot_dqdq_dq 2 | |
set /test """" | |
get /test | |
prints | |
/test = | |
test quot_dqdqdq -1 ECMDRUN | |
set /test """ | |
test quot_dqdqdq_sq 2 | |
set /test '"""' | |
get /test | |
prints | |
/test = """ | |
test quot_dqdqdq_dq -1 ECMDRUN | |
set /test """"" | |
test quot_dqdqdqdq 2 | |
set /test """" | |
get /test | |
prints | |
/test = | |
test quot_dqdqdqdq_sq 2 | |
set /test '""""' | |
get /test | |
prints | |
/test = """" | |
test quot_dqdqdqdq_dq 2 | |
set /test """""" | |
get /test | |
prints | |
/test = | |
test quot_truncated_dq 2 | |
set /test "s"bc"d"ef | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_dq_sq 2 | |
set /test '"s"bc"d"ef' | |
get /test | |
prints | |
/test = "s"bc"d"ef | |
test quot_truncated_dq_dq 2 | |
set /test ""s"bc"d"ef" | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_sq 2 | |
set /test 's'bc'd'ef | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_sq_sq 2 | |
set /test ''s'bc'd'ef' | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_sq_dq 2 | |
set /test "'s'bc'd'ef" | |
get /test | |
prints | |
/test = 's'bc'd'ef | |
test quot_truncated_dq_mix 2 | |
set /test "s"bc'd'ef | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_dq_mix_sq 2 | |
set /test '"s"bc'd'ef' | |
get /test | |
prints | |
/test = "s"bcdef | |
test quot_truncated_dq_mix_dq 2 | |
set /test ""s"bc'd'ef" | |
get /test | |
prints | |
/test = sbc'd'ef | |
test quot_truncated_sq_mix 2 | |
set /test 's'bc"d"ef | |
get /test | |
prints | |
/test = sbcdef | |
test quot_truncated_sq_mix_sq 2 | |
set /test ''s'bc"d"ef' | |
get /test | |
prints | |
/test = sbc"d"ef | |
test quot_truncated_sq_mix_dq 2 | |
set /test "'s'bc"d"ef" | |
get /test | |
prints | |
/test = 's'bcdef | |
test quot_truncated_space -1 ECMDRUN | |
set /test before after | |
test quot_truncated_space_sq 2 | |
set /test 'before after' | |
get /test | |
prints | |
/test = before after | |
test quot_truncated_space_dq 2 | |
set /test "before after" | |
get /test | |
prints | |
/test = before after | |
test quot_mix -1 ECMDRUN | |
set /test a"b'c"d'e | |
test quot_mix_sq -1 ECMDRUN | |
set /test 'a"b'c"d'e' | |
test quot_mix_dq -1 ECMDRUN | |
set /test "a"b'c"d'e" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment