summaryrefslogtreecommitdiff
path: root/Data/Libraries/LDoc/tests/simple
diff options
context:
space:
mode:
Diffstat (limited to 'Data/Libraries/LDoc/tests/simple')
-rw-r--r--Data/Libraries/LDoc/tests/simple/problem.lua19
-rw-r--r--Data/Libraries/LDoc/tests/simple/simple.lua12
-rw-r--r--Data/Libraries/LDoc/tests/simple/simple_alias.lua16
-rw-r--r--Data/Libraries/LDoc/tests/simple/tables.lua39
4 files changed, 86 insertions, 0 deletions
diff --git a/Data/Libraries/LDoc/tests/simple/problem.lua b/Data/Libraries/LDoc/tests/simple/problem.lua
new file mode 100644
index 0000000..3848539
--- /dev/null
+++ b/Data/Libraries/LDoc/tests/simple/problem.lua
@@ -0,0 +1,19 @@
+--- this module has a comment.
+
+local local_two
+
+--- a local function
+local function local_one ()
+end
+
+--- a local function, needing explicit tag.
+-- @local here
+function local_two ()
+
+end
+
+--- A problem function.
+-- @param p a parameter
+function problem.fun(p)
+ return 42
+end
diff --git a/Data/Libraries/LDoc/tests/simple/simple.lua b/Data/Libraries/LDoc/tests/simple/simple.lua
new file mode 100644
index 0000000..15d2a39
--- /dev/null
+++ b/Data/Libraries/LDoc/tests/simple/simple.lua
@@ -0,0 +1,12 @@
+------------
+-- A little old-style module
+local io = io
+-- we'll look for this
+module 'simple'
+
+-- if it were 'module (...)' then the name has to be deduced.
+
+--- return the answer.
+function answer()
+ return 42
+end
diff --git a/Data/Libraries/LDoc/tests/simple/simple_alias.lua b/Data/Libraries/LDoc/tests/simple/simple_alias.lua
new file mode 100644
index 0000000..72d17af
--- /dev/null
+++ b/Data/Libraries/LDoc/tests/simple/simple_alias.lua
@@ -0,0 +1,16 @@
+------------
+-- A new-style module.
+-- Shows how @alias can be used to tell ldoc that a given name
+-- is a shorthand for the full module name
+-- @alias M
+
+local simple_alias = {}
+local M = simple_alias
+
+--- return the answer. And complete the description
+function M.answer()
+ return 42
+end
+
+return simple_alias
+
diff --git a/Data/Libraries/LDoc/tests/simple/tables.lua b/Data/Libraries/LDoc/tests/simple/tables.lua
new file mode 100644
index 0000000..bdc612d
--- /dev/null
+++ b/Data/Libraries/LDoc/tests/simple/tables.lua
@@ -0,0 +1,39 @@
+------------
+-- A module containing tables.
+-- Shows how Lua table definitions can be conveniently parsed.
+--
+-- There may be multiple comment lines per field/parameter, and
+-- such comments may begin with `TYPE:`
+--
+-- Functions also can be commented in a similar way, and the last
+-- parameter's comment may be outside the parens.
+--
+-- @alias M
+
+local tables = {}
+local M = tables
+
+--- a function.
+function M.one(
+ bonzo, -- dog
+ -- has its day!
+ frodo) --baggins
+end
+
+--- first table.
+-- @table one
+M.one = {
+ A = 1, -- alpha
+ B = 2; -- beta
+}
+
+--- second table.
+-- we don't need an explicit table tag, since it
+-- can be inferred from the context.
+M.two = {
+ N = 10, -- int: no. of cases
+ L = 'label' -- string: case label
+}
+
+return M
+