dev

This module contains testcases for its parent module, Codedoc.

See also


-- <nowiki>
-- Unit tests for [[Module:Codedoc/Procsrc]] submodule.
return {
    get_functions = {
        options = {
            mode   = 'method',
            nowiki = true,
            self   = true,
            unpk   = true,
            deep   = true
        }, 
        tests = {
            {
                {
                    '--% Build function commentary structure from text\n--@ test(string) program code\n--: (table) function structure\nfunction testfunction (test)\n    return {}\nend'
                },
                {
                    {
                        name = "testfunction",
                        parameters = {
                            { name = "test", purpose = "program code.", type = "string" }
                        },
                        purpose = "Build function commentary structure from text.",
                        returns = {
                            { purpose = "function structure.", type = "table" }
                        }
                    }
                }
            },
            {
                {
                    '--% Build function commentary structure from text\n--@ test(string) program code\n--: (table) function structure\nfunction _testfunction (test)\n    return {}\nend'
                },
                {
                    {
                        name = "_testfunction",
                        parameters = {
                            { name = "test", purpose = "program code.", type = "string" }
                        },
                        purpose = "Build function commentary structure from text.",
                        returns = {
                            { purpose = "function structure.", type = "table" }
                        }
                    }
                }
            },
        }
    },
    scan_lines = {
        options = {
            mode   = 'method',
            nowiki = true,
            self   = true,
            unpk   = true,
            deep   = true
        }, 
        tests = {
            {
                {
                    '--% Build function commentary structure from text\n--@ test(string) program code\n--: (table) function structure\nfunction testfunction (test)\n    return {}\nend',
                    '%%@:Tb-',
                    '^%s*(f)unction%s+([%w:._]*)'
                },
                {
                    { "%", "Build function commentary structure from text" },
                    { "@", "test(string) program code" },
                    { ":", "(table) function structure" },
                    { "f", "testfunction" },
                    ["n"] = 0
                }
            }
        }
    }
}
-- </nowiki>