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
106b34ce
Commit
106b34ce
authored
Dec 29, 2015
by
Vinicius Jarina
Browse files
Added test to ctor overload.
parent
24280821
Changes
4
Show whitespace changes
Inline
Side-by-side
ConsoleTest/Program.cs
View file @
106b34ce
...
@@ -22,9 +22,11 @@ namespace ConsoleTest
...
@@ -22,9 +22,11 @@ namespace ConsoleTest
{
{
using
(
var
l
=
new
Lua
())
{
using
(
var
l
=
new
Lua
())
{
l
.
LoadCLRPackage
();
l
.
LoadCLRPackage
();
l
.
DoString
(
" import ('ConsoleTest') "
);
l
.
DoString
(
" import ('ConsoleTest'
, 'NLuaTest.Mock'
) "
);
l
.
DoString
(
@"
l
.
DoString
(
@"
Program.Method (1)
e1 = Entity()
e2 = Entity ('Another world')
e3 = Entity (10)
"
);
"
);
}
}
}
}
...
...
KopiLua
@
7dbc7e4f
Compare
2f0dfdcc
...
7dbc7e4f
Subproject commit
2f0dfdcc50acca3e88afa6ef5cc5ad97f142
e57
a
Subproject commit
7dbc7e4f95e9a7a60d59ef500e7767284aed
e57
c
tests/Entity.cs
View file @
106b34ce
...
@@ -18,11 +18,28 @@ namespace NLuaTest.Mock
...
@@ -18,11 +18,28 @@ namespace NLuaTest.Mock
}
}
}
}
public
string
Property
{
get
;
set
;
}
// default ctor
public
Entity
()
public
Entity
()
{
{
Property
=
"Default"
;
}
// string ctor
public
Entity
(
string
param
)
{
Property
=
"String"
;
}
}
public
Entity
(
int
param
)
{
Property
=
"Int"
;
}
public
void
Click
()
public
void
Click
()
{
{
OnEntityClicked
(
new
EventArgs
());
OnEntityClicked
(
new
EventArgs
());
...
...
tests/LuaTests.cs
View file @
106b34ce
...
@@ -2472,6 +2472,29 @@ namespace NLuaTest
...
@@ -2472,6 +2472,29 @@ namespace NLuaTest
}
}
}
}
[
Test
]
public
void
TestConstructorOverload
()
{
using
(
var
l
=
new
Lua
())
{
l
.
LoadCLRPackage
();
l
.
DoString
(
" import ('NLuaTest','NLuaTest.Mock') "
);
l
.
DoString
(
@"
e1 = Entity()
e2 = Entity ('str_param')
e3 = Entity (10)
p1 = e1.Property
p2 = e2.Property
p3 = e3.Property
"
);
string
p1
=
l
.
GetString
(
"p1"
);
string
p2
=
l
.
GetString
(
"p2"
);
string
p3
=
l
.
GetString
(
"p3"
);
Assert
.
AreEqual
(
"Default"
,
p1
,
"#1"
);
Assert
.
AreEqual
(
"String"
,
p2
,
"#1"
);
Assert
.
AreEqual
(
"Int"
,
p3
,
"#1"
);
}
}
static
Lua
m_lua
;
static
Lua
m_lua
;
}
}
...
...
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