|
| 1 | +# ============================================================================== |
| 2 | +# Functions using the Doxygen doc standard. |
| 3 | +# ============================================================================== |
| 4 | +Given python(function without parameters without return type where b:doge_doc_standard='doxygen'): |
| 5 | + def myFunc(): |
| 6 | + pass |
| 7 | + |
| 8 | +Do (trigger doge): |
| 9 | + :let b:doge_doc_standard='doxygen'\<CR> |
| 10 | + \<C-d> |
| 11 | + |
| 12 | +Expect python (generated comment with nothing but the text 'TODO'): |
| 13 | + def myFunc(): |
| 14 | + """! @brief [TODO:description]""" |
| 15 | + pass |
| 16 | + |
| 17 | +# ------------------------------------------------------------------------------ |
| 18 | + |
| 19 | +Given python(function with parameters without type hints without return type where b:doge_doc_standard='doxygen'): |
| 20 | + def myFunc(p1, p2, p3 = ''): |
| 21 | + pass |
| 22 | + |
| 23 | +Do (trigger doge): |
| 24 | + :let b:doge_doc_standard='doxygen'\<CR> |
| 25 | + \<C-d> |
| 26 | + |
| 27 | +Expect python (generated comment without type hints with defaults and optional): |
| 28 | + def myFunc(p1, p2, p3 = ''): |
| 29 | + """! |
| 30 | + @brief [TODO:description] |
| 31 | + |
| 32 | + @param p1 [TODO:description] |
| 33 | + @param p2 [TODO:description] |
| 34 | + @param p3 [TODO:description] |
| 35 | + """ |
| 36 | + pass |
| 37 | + |
| 38 | +# ------------------------------------------------------------------------------ |
| 39 | + |
| 40 | +Given python(function with parameters with type hints without return type where b:doge_doc_standard='doxygen'): |
| 41 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []): |
| 42 | + pass |
| 43 | + |
| 44 | +Do (trigger doge): |
| 45 | + :let b:doge_doc_standard='doxygen'\<CR> |
| 46 | + \<C-d> |
| 47 | + |
| 48 | +Expect python (generated comment with type hints, defaults and optional): |
| 49 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []): |
| 50 | + """! |
| 51 | + @brief [TODO:description] |
| 52 | + |
| 53 | + @param p1 [TODO:description] |
| 54 | + @param p2 [TODO:description] |
| 55 | + @param p3 [TODO:description] |
| 56 | + """ |
| 57 | + pass |
| 58 | + |
| 59 | +# ------------------------------------------------------------------------------ |
| 60 | + |
| 61 | +Given python(function with parameters with type hints with return type where b:doge_doc_standard='doxygen'): |
| 62 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []) -> Sequence[T]: |
| 63 | + pass |
| 64 | + |
| 65 | +Do (trigger doge): |
| 66 | + :let b:doge_doc_standard='doxygen'\<CR> |
| 67 | + \<C-d> |
| 68 | + |
| 69 | +Expect python (generated comment with @param and @return tags): |
| 70 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []) -> Sequence[T]: |
| 71 | + """! |
| 72 | + @brief [TODO:description] |
| 73 | + |
| 74 | + @param p1 [TODO:description] |
| 75 | + @param p2 [TODO:description] |
| 76 | + @param p3 [TODO:description] |
| 77 | + |
| 78 | + @return [TODO:description] |
| 79 | + """ |
| 80 | + pass |
| 81 | + |
| 82 | +# ============================================================================== |
| 83 | +# Read out the exceptions in the function body |
| 84 | +# ============================================================================== |
| 85 | +Given python (function with exceptions being raised in the body): |
| 86 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []) -> Sequence[T]: |
| 87 | + try: |
| 88 | + foo = ValueError() |
| 89 | + raise foo |
| 90 | + raise Exception() |
| 91 | + except Exception as error: |
| 92 | + pass |
| 93 | + |
| 94 | +Do (trigger doge): |
| 95 | + :let b:doge_doc_standard='doxygen'\<CR> |
| 96 | + \<C-d> |
| 97 | + |
| 98 | +Expect python (generated comment with @param and @throws tags): |
| 99 | + def myFunc(p1, p2: Callable[[int], None], p3: Callable[[int, Exception], None] = []) -> Sequence[T]: |
| 100 | + """! |
| 101 | + @brief [TODO:description] |
| 102 | + |
| 103 | + @param p1 [TODO:description] |
| 104 | + @param p2 [TODO:description] |
| 105 | + @param p3 [TODO:description] |
| 106 | + |
| 107 | + @return [TODO:description] |
| 108 | + |
| 109 | + @throws [TODO:name] [TODO:description] |
| 110 | + @throws Exception [TODO:description] |
| 111 | + """ |
| 112 | + try: |
| 113 | + foo = ValueError() |
| 114 | + raise foo |
| 115 | + raise Exception() |
| 116 | + except Exception as error: |
| 117 | + pass |
0 commit comments