Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
aab4cbd3
Commit
aab4cbd3
authored
Feb 09, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple unit testing stuff (working on it)
parent
6d7f3a6c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
0 deletions
+77
-0
tests/script/run-tests.pl
tests/script/run-tests.pl
+45
-0
tests/script/test-builtin.mse-script
tests/script/test-builtin.mse-script
+5
-0
tests/script/test-magic.mse-script
tests/script/test-magic.mse-script
+0
-0
tests/util/MseTestUtils.pm
tests/util/MseTestUtils.pm
+27
-0
No files found.
tests/script/run-tests.pl
0 → 100644
View file @
aab4cbd3
#!/usr/bin/perl
# For each mse-script file:
# 1. Invoke magicseteditor
# 2. Ensure that there are no errors
use
strict
;
use
File::
Find
;
use
File::
Basename
;
use
lib
"
../util/
";
use
MseTestUtils
;
# -----------------------------------------------------------------------------
# Utility functions
# -----------------------------------------------------------------------------
# Invoke a script
sub
run_script_test
{
my
$script
=
shift
;
my
$args
=
shift
;
my
$expected
=
basename
(
$script
,"
.mse-script
")
.
"
.out.expected
";
my
$outfile
=
basename
(
$script
,"
.mse-script
")
.
"
.out
";
my
$command
=
"
$MseTestUtils
::MAGICSETEDITOR --cli --quiet --script
$script
$args
>
$outfile
";
print
"
$command
\n
";
`
$command
`;
# TODO: diff against expected output
}
sub
write_dummy_set
{
my
$setname
=
shift
;
my
$contents
=
shift
;
mkdir
(
$setname
);
open
SET
,"
>
$setname
/set
";
print
SET
"
mse version: 2.0.0
\n
";
print
SET
$contents
;
close
SET
;
}
# -----------------------------------------------------------------------------
# The tests
# -----------------------------------------------------------------------------
run_script_test
("
test-builtin1.mse-script
",
"");
write_dummy_set
("
dummy-magic-set.mse-set
",
"
game: magic
\n
stylesheet: new
\n
");
run_script_test
("
test-magic.mse-script
",
"
dummy-magic-set
");
tests/script/test-builtin.mse-script
0 → 100644
View file @
aab4cbd3
#!/usr/bin/magicseteditor --cli
# Test the scripting language itself, and built in functions
assert(true);
tests/script/test-magic.mse-script
0 → 100644
View file @
aab4cbd3
tests/util/MseTestUtils.pm
0 → 100644
View file @
aab4cbd3
#+----------------------------------------------------------------------------+
#| Description: Magic Set Editor - Program to make Magic (tm) cards |
#| Copyright: (C) 2001 - 2011 Twan van Laarhoven and Sean Hunt |
#| License: GNU General Public License 2 or later (see file COPYING) |
#+----------------------------------------------------------------------------+
package
MseTestUtils
;
use
strict
;
# -----------------------------------------------------------------------------
# Utilities for testing scripts
# -----------------------------------------------------------------------------
# Find magicseteditor executable
our
$MAGICSETEDITOR
;
my
$is_windows
=
$^O
=~
/win/i
;
if
(
$is_windows
)
{
$MAGICSETEDITOR
=
"
\"
../../build/Release Unicode/mse.exe
\"
";
}
else
{
$MAGICSETEDITOR
=
"
../../magicseteditor
";
}
# -----------------------------------------------------------------------------
1
;
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