From 53364ddc2e09362cb17432abf4fb598557554a9f Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:42:13 +0800 Subject: + LDoc --- Data/Libraries/LDoc/tests/styles/multiple.lua | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Data/Libraries/LDoc/tests/styles/multiple.lua (limited to 'Data/Libraries/LDoc/tests/styles/multiple.lua') diff --git a/Data/Libraries/LDoc/tests/styles/multiple.lua b/Data/Libraries/LDoc/tests/styles/multiple.lua new file mode 100644 index 0000000..85e12b9 --- /dev/null +++ b/Data/Libraries/LDoc/tests/styles/multiple.lua @@ -0,0 +1,45 @@ +------ +-- Various ways of indicating errors +-- @module multiple + +----- +-- function with return groups. +-- @treturn[1] string result +-- @return[2] nil +-- @return[2] error message +function mul1 () end + +----- +-- function with return and error tag +-- @return result +-- @error message +function mul2 () end + +----- +-- function with multiple error tags +-- @return result +-- @error not found +-- @error bad format +function mul3 () end + +---- +-- function with inline return and errors +-- @string name +function mul4 (name) + if type(name) ~= 'string' then + --- @error[1] not a string + return nil, 'not a string' + end + if #name == 0 then + --- @error[2] zero-length string + return nil, 'zero-length string' + end + --- @treturn string converted to uppercase + return name:upper() +end +----- +-- function that raises an error. +-- @string filename +-- @treturn string result +-- @raise 'file not found' +function mul5(filename) end -- cgit v1.1-26-g67d0