Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
61231a74
Commit
61231a74
authored
Mar 16, 2013
by
Vinicius Jarina
Browse files
Added core tests to NLua (bisect, life, trace-globals...)
parent
2da7b6e8
Changes
6
Show whitespace changes
Inline
Side-by-side
ConsoleTest/ConsoleTest.csproj
View file @
61231a74
...
...
@@ -9,8 +9,11 @@
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
ConsoleTest
</RootNamespace>
<AssemblyName>
ConsoleTest
</AssemblyName>
<TargetFrameworkVersion>
v4.
5
</TargetFrameworkVersion>
<TargetFrameworkVersion>
v4.
0
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<ReleaseVersion>
2.x
</ReleaseVersion>
<ProductVersion>
12.0.0
</ProductVersion>
<SchemaVersion>
2.0
</SchemaVersion>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
...
...
@@ -53,7 +56,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\Core\NLua\NLua.csproj"
>
<Project>
{
f
55
cabbb
-4108-4
a
39-94
e
1-581
fd46dc
021}
</Project>
<Project>
{
F
55
CABBB
-4108-4
A
39-94
E
1-581
FD46DC
021}
</Project>
<Name>
NLua
</Name>
</ProjectReference>
</ItemGroup>
...
...
Core/NLua/Lua.cs
View file @
61231a74
...
...
@@ -1006,6 +1006,11 @@ namespace NLua
LuaLib
.
lua_settop
(
luaState
,
oldTop
);
}
public
LuaFunction
RegisterFunction
(
string
path
,
MethodBase
function
/*MethodInfo function*/
)
{
return
RegisterFunction
(
path
,
null
,
function
);
}
/*
* Registers an object's method as a Lua function (global or table field)
* The method may have any signature
...
...
NLuaTest/NLuaTest.csproj
View file @
61231a74
...
...
@@ -50,6 +50,9 @@
<Compile
Include=
"..\tests\TestLua.cs"
>
<Link>
TestLua.cs
</Link>
</Compile>
<Compile
Include=
"..\tests\Core.cs"
>
<Link>
Core.cs
</Link>
</Compile>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
...
...
ios/NLuaTestsiOS/Core.cs
deleted
100644 → 0
View file @
2da7b6e8
using
System
;
using
NUnit.Framework
;
namespace
NLuaTest
{
[
TestFixture
]
public
class
Core
{
[
Test
]
public
void
Pass
()
{
Assert
.
True
(
true
);
}
[
Test
]
public
void
Fail
()
{
//Assert.False (true);
}
[
Test
]
[
Ignore
(
"another time"
)]
public
void
Ignore
()
{
//Assert.True (false);
}
}
}
run_all.win32.bat
View file @
61231a74
cd
Core
\KeraLua
Makefile
.Win32.bat
call
Makefile
.Win32.bat
msbuild
KeraLua
.sln
/p
:Configuration
=
Release
cd
..\..
xcopy
Core
\KeraLua\external\lua\win32\bin\
*
.dll
tests
\
*
.dll
...
...
tests/Core.cs
0 → 100644
View file @
61231a74
using
System
;
using
NUnit.Framework
;
using
NLua
;
using
NLua.Exceptions
;
using
System.IO
;
#if MONOTOUCH
using
MonoTouch.Foundation
;
#endif
namespace
NLuaTest
{
[
TestFixture
]
#
if
MONOTOUCH
[
Preserve
(
AllMembers
=
true
)]
#
endif
public
class
Core
{
Lua
lua
=
null
;
string
GetTestPath
(
string
name
)
{
string
filePath
=
Path
.
Combine
(
Path
.
Combine
(
"LuaTests"
,
"core"
),
name
+
".lua"
);
return
filePath
;
}
void
AssertFile
(
string
path
)
{
lua
.
DoFile
(
path
);
}
void
TestLuaFile
(
string
name
)
{
string
path
=
GetTestPath
(
name
);
AssertFile
(
path
);
}
[
SetUp
]
public
void
Setup
()
{
lua
=
new
Lua
();
lua
.
RegisterFunction
(
"print"
,
typeof
(
Console
).
GetMethod
(
"WriteLine"
,
new
Type
[]
{
typeof
(
String
)
}));
}
[
TearDown
]
public
void
TearDown
()
{
lua
.
Dispose
();
lua
=
null
;
}
[
Test
]
public
void
Bisect
()
{
TestLuaFile
(
"bisect"
);
Assert
.
True
(
true
);
}
[
Test
]
public
void
CF
()
{
TestLuaFile
(
"cf"
);
}
[
Test
]
public
void
Env
()
{
TestLuaFile
(
"env"
);
}
[
Test
]
public
void
Factorial
()
{
TestLuaFile
(
"factorial"
);
}
[
Test
]
public
void
FibFor
()
{
TestLuaFile
(
"fibfor"
);
}
[
Test
]
public
void
Life
()
{
TestLuaFile
(
"life"
);
}
[
Test
]
public
void
Printf
()
{
TestLuaFile
(
"printf"
);
}
[
Test
]
public
void
ReadOnly
()
{
TestLuaFile
(
"readonly"
);
}
[
Test
]
public
void
Sieve
()
{
TestLuaFile
(
"sieve"
);
}
[
Test
]
public
void
Sort
()
{
TestLuaFile
(
"sort"
);
}
[
Test
]
public
void
TraceGlobals
()
{
TestLuaFile
(
"trace-globals"
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment