File: a00031.html

package info (click to toggle)
lutok 0.4%2Bdfsg-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,980 kB
  • sloc: sh: 11,302; cpp: 2,350; javascript: 1,131; makefile: 189
file content (177 lines) | stat: -rw-r--r-- 10,473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Lutok: test_utils.hpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/usr/share/javascript/jquery/jquery.min.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Lutok
   &#160;<span id="projectnumber">0.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">test_utils.hpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Utilities for tests of the lua modules.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;atf-c++.hpp&gt;</code><br/>
<code>#include &quot;<a class="el" href="a00013_source.html">c_gate.hpp</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="a00019_source.html">exceptions.hpp</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="a00028_source.html">state.hpp</a>&quot;</code><br/>
</div>
<p><a href="a00031_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00001.html">anonymous_namespace{test_utils.hpp}::stack_balance_checker</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ensures that the Lua stack maintains its original height upon exit.  <a href="a00001.html#details">More...</a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:a00035"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00035.html">anonymous_namespace{test_utils.hpp}</a></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a8f10eccfd8799f9631163705fb92ea5a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00031.html#a8f10eccfd8799f9631163705fb92ea5a">REQUIRE_API_ERROR</a>(exp_api_function, statement)</td></tr>
<tr class="memdesc:a8f10eccfd8799f9631163705fb92ea5a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks that a given expression raises a particular <a class="el" href="a00002.html" title="Exception for errors raised by the Lua API library.">lutok::api_error</a>.  <a href="#a8f10eccfd8799f9631163705fb92ea5a"></a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:af152deed7545b6ecb284e113c02ba6e2"><td class="memItemLeft" align="right" valign="top">static lua_State *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00035.html#af152deed7545b6ecb284e113c02ba6e2">anonymous_namespace{test_utils.hpp}::raw</a> (<a class="el" href="a00009.html">lutok::state</a> &amp;state)</td></tr>
<tr class="memdesc:af152deed7545b6ecb284e113c02ba6e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the pointer to the internal lua_State of a state object.  <a href="#af152deed7545b6ecb284e113c02ba6e2"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Utilities for tests of the lua modules. </p>
<p>This file is intended to be included once, and only once, for every test program that needs it. All the code is herein contained to simplify the dependency chain in the build rules. </p>
</div><hr/><h2>Macro Definition Documentation</h2>
<a class="anchor" id="a8f10eccfd8799f9631163705fb92ea5a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define REQUIRE_API_ERROR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">exp_api_function, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">statement&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keywordflow">do</span> { \</div>
<div class="line">        try { \</div>
<div class="line">            statement; \</div>
<div class="line">            ATF_FAIL(<span class="stringliteral">&quot;api_error not raised by &quot;</span> #statement); \</div>
<div class="line">        } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code" href="a00002.html" title="Exception for errors raised by the Lua API library.">lutok::api_error</a>&amp; api_error) { \</div>
<div class="line">            ATF_REQUIRE_EQ(exp_api_function, api_error.<a class="code" href="a00002.html#a5558d8cf055e38904d3e571781e50b4b" title="Gets the name of the Lua API function that caused this error.">api_function</a>()); \</div>
<div class="line">        } \</div>
<div class="line">    } <span class="keywordflow">while</span> (0)</div>
</div><!-- fragment -->
<p>Checks that a given expression raises a particular <a class="el" href="a00002.html" title="Exception for errors raised by the Lua API library.">lutok::api_error</a>. </p>
<p>We cannot make any assumptions regarding the error text provided by Lua, so we resort to checking only which API function raised the error (because our code is the one hardcoding these strings).</p>
<dl class="params"><dt>Parameters:</dt><dd>
  <table class="params">
    <tr><td class="paramname">exp_api_function</td><td>The name of the Lua C API function that causes the error. </td></tr>
    <tr><td class="paramname">statement</td><td>The statement to execute. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Dec 7 2013 19:02:36 for Lutok by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>