MCPcopy Create free account
hub / github.com/anjo76/angelscript / Test

Function Test

sdk/tests/test_feature/source/test_scriptstruct.cpp:150–2541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150bool Test()
151{
152 bool fail = false;
153 int r;
154 asIScriptModule *mod;
155 asIScriptEngine *engine;
156 COutStream out;
157 CBufferedOutStream bout;
158
159 // Mixins do not support deleting methods
160 {
161 engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
162 engine->SetMessageCallback(asMETHOD(CBufferedOutStream, Callback), &bout, asCALL_THISCALL);
163
164 const char* script =
165 "mixin class A \n"
166 "{ \n"
167 " A() delete; \n"
168 " A(const A &inout) delete; \n"
169 " A &opAssign(const A &inout) delete; \n"
170 " void func() delete; \n"
171 "} \n"
172 "class B : A {} \n";
173
174 mod = engine->GetModule("t", asGM_ALWAYS_CREATE);
175 mod->AddScriptSection("script", script);
176
177 bout.buffer = "";
178 r = mod->Build();
179 if (r >= 0)
180 TEST_FAILED;
181
182 if (bout.buffer !=
183 "script (3, 2) : Error : Mixin classes cannot have constructors or destructors\n"
184 "script (4, 10) : Error : Identifier 'A' is not a data type in global namespace\n"
185 "script (4, 12) : Error : Only object types that support object handles can use &inout. Use &in or &out instead\n"
186 "script (4, 2) : Error : Mixin classes cannot have constructors or destructors\n"
187 "script (5, 2) : Error : Identifier 'A' is not a data type in global namespace\n"
188 "script (5, 20) : Error : Identifier 'A' is not a data type in global namespace\n"
189 "script (5, 22) : Error : Only object types that support object handles can use &inout. Use &in or &out instead\n"
190 "script (5, 2) : Error : Cannot flag function that will not be auto generated as deleted\n"
191 "script (6, 2) : Error : Cannot flag function that will not be auto generated as deleted\n")
192 {
193 PRINTF("%s", bout.buffer.c_str());
194 TEST_FAILED;
195 }
196
197 engine->Release();
198 }
199
200 // Interfaces do not support deleting methods
201 {
202 engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
203 engine->SetMessageCallback(asMETHOD(CBufferedOutStream, Callback), &bout, asCALL_THISCALL);
204
205 const char* script =
206 "interface A \n"
207 "{ \n"

Callers

nothing calls this directly

Calls 15

ExecuteStringFunction · 0.85
Test_mainFunction · 0.85
RegisterStdStringFunction · 0.85
RegisterScriptArrayFunction · 0.85
asGetLibraryOptionsFunction · 0.85
RegisterScriptHandleFunction · 0.85
GetExceptionInfoFunction · 0.85
SetMessageCallbackMethod · 0.80
AddScriptSectionMethod · 0.80
ShutDownAndReleaseMethod · 0.80
IsExplicitMethod · 0.80

Tested by

no test coverage detected