Fandom Developers Wiki
m (Add simple named args test)
(Add tests that reveal Testharness' weaknesses)
Line 30: Line 30:
 
"when=you walk away| you = don't hear me say ",
 
"when=you walk away| you = don't hear me say ",
 
'"when" => "you walk away"\n"you" => "don\'t hear me say"\n'
 
'"when" => "you walk away"\n"you" => "don\'t hear me say"\n'
  +
},
  +
{
  +
-- Named arg (where the arg name has a space)
  +
'"pleeeeeeeeeeeeeease, oh baby, don\'t go"|simple and clean = the way that you\'re making me feel tonight',
  +
'1 => "\\"pleeeeeeeeeeeeeease, oh baby, don\'t go\\""\n"simple and clean" => "the way that you\'re making me feel tonight"\n'
  +
},
  +
{
  +
-- Preprocessing of arg keys and values
  +
'{{!}}{{=}}|{{!}}{{=}}={{!}}{{=}}',
  +
'1 => "|="\n"|=" => "|="\n'
 
}
 
}
 
}
 
}

Revision as of 06:02, 22 February 2020

This module contains testcases for its parent module, Testharness.

See also


return {
    dump_args = {
        options = {
            mode = 'invocation',
            nowiki = true
        },
        tests = {
            {
                -- Anonymous args
                'one|two|buckle my shoe',
                '1 => "one"\n2 => "two"\n3 => "buckle my shoe"\n'
            },
            {
                -- Out-of-order anonymous and numbered args with overriding
                'first|overridden second|3=overridden third|third|2=second|fourth',
                '1 => "first"\n2 => "second"\n3 => "third"\n4 => "fourth"\n'
            },
            {
                -- Whitespace preservation on anonymous args
                '   My hovercraft is full of eels.   ',
                '1 => "   My hovercraft is full of eels.   "\n'
            },
            {
                -- Whitespace stripping on numbered args
                '1=   My hovercraft is full of eels.   ',
                '1 => "My hovercraft is full of eels."\n'
            },
            {
                -- Named args (including whitespace stripping)
                "when=you walk away| you = don't hear me say ",
                '"when" => "you walk away"\n"you" => "don\'t hear me say"\n'
            },
            {
                -- Named arg (where the arg name has a space)
                '"pleeeeeeeeeeeeeease, oh baby, don\'t go"|simple and clean = the way that you\'re making me feel tonight',
                '1 => "\\"pleeeeeeeeeeeeeease, oh baby, don\'t go\\""\n"simple and clean" => "the way that you\'re making me feel tonight"\n'
            },
            {
                -- Preprocessing of arg keys and values
                '{{!}}{{=}}|{{!}}{{=}}={{!}}{{=}}',
                '1 => "|="\n"|=" => "|="\n'
            }
        }
    }
}