Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
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
Libraries
mruby
Commits
bcd10c71
Commit
bcd10c71
authored
Oct 01, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2973 from mattn/fix-windows-tests
fix tests on windows.
parents
81ec5f5d
545d649e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
28 deletions
+36
-28
mrbgems/mruby-bin-mruby/bintest/mruby.rb
mrbgems/mruby-bin-mruby/bintest/mruby.rb
+10
-10
mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
+16
-16
mrbgems/mruby-compiler/bintest/mrbc.rb
mrbgems/mruby-compiler/bintest/mrbc.rb
+2
-2
test/bintest.rb
test/bintest.rb
+8
-0
No files found.
mrbgems/mruby-bin-mruby/bintest/mruby.rb
View file @
bcd10c71
require
'tempfile'
require
'tempfile'
assert
(
'regression for #1564'
)
do
assert
(
'regression for #1564'
)
do
o
=
`
bin/mruby -e '<<'
2>&1`
o
=
`
#{
cmd
(
'mruby'
)
}
-e
#{
shellquote
(
'<<'
)
}
2>&1`
assert_equal
o
,
"-e:1:2: syntax error, unexpected tLSHFT
\n
"
assert_equal
o
,
"-e:1:2: syntax error, unexpected tLSHFT
\n
"
o
=
`
bin/mruby -e '<<-'
2>&1`
o
=
`
#{
cmd
(
'mruby'
)
}
-e
#{
shellquote
(
'<<-'
)
}
2>&1`
assert_equal
o
,
"-e:1:3: syntax error, unexpected tLSHFT
\n
"
assert_equal
o
,
"-e:1:3: syntax error, unexpected tLSHFT
\n
"
end
end
assert
(
'regression for #1572'
)
do
assert
(
'regression for #1572'
)
do
script
,
bin
=
Tempfile
.
new
(
'test.rb'
),
Tempfile
.
new
(
'test.mrb'
)
script
,
bin
=
Tempfile
.
new
(
'test.rb'
),
Tempfile
.
new
(
'test.mrb'
)
system
"echo 'p
\"
ok
\"
' >
#{
script
.
path
}
"
File
.
write
script
.
path
,
'p "ok"'
system
"
bin/mrbc
-g -o
#{
bin
.
path
}
#{
script
.
path
}
"
system
"
#{
cmd
(
'mrbc'
)
}
-g -o
#{
bin
.
path
}
#{
script
.
path
}
"
o
=
`
bin/mruby
-b
#{
bin
.
path
}
`
.
strip
o
=
`
#{
cmd
(
'mruby'
)
}
-b
#{
bin
.
path
}
`
.
strip
assert_equal
o
,
'"ok"'
assert_equal
o
,
'"ok"'
end
end
...
@@ -21,14 +21,14 @@ assert '$0 value' do
...
@@ -21,14 +21,14 @@ assert '$0 value' do
# .rb script
# .rb script
script
.
write
"p $0
\n
"
script
.
write
"p $0
\n
"
script
.
flush
script
.
flush
assert_equal
"
\"
#{
script
.
path
}
\"
"
,
`
./bin/mruby
"
#{
script
.
path
}
"`
.
chomp
assert_equal
"
\"
#{
script
.
path
}
\"
"
,
`
#{
cmd
(
'mruby'
)
}
"
#{
script
.
path
}
"`
.
chomp
# .mrb file
# .mrb file
`
./bin/mrbc
-o "
#{
bin
.
path
}
" "
#{
script
.
path
}
"`
`
#{
cmd
(
'mrbc'
)
}
-o "
#{
bin
.
path
}
" "
#{
script
.
path
}
"`
assert_equal
"
\"
#{
bin
.
path
}
\"
"
,
`
./bin/mruby
-b "
#{
bin
.
path
}
"`
.
chomp
assert_equal
"
\"
#{
bin
.
path
}
\"
"
,
`
#{
cmd
(
'mruby'
)
}
-b "
#{
bin
.
path
}
"`
.
chomp
# one liner
# one liner
assert_equal
'"-e"'
,
`
./bin/mruby -e 'p $0'
`
.
chomp
assert_equal
'"-e"'
,
`
#{
cmd
(
'mruby'
)
}
-e
#{
shellquote
(
'p $0'
)
}
`
.
chomp
end
end
assert
'__END__'
,
'8.6'
do
assert
'__END__'
,
'8.6'
do
...
@@ -42,5 +42,5 @@ __END__
...
@@ -42,5 +42,5 @@ __END__
p 'legend'
p 'legend'
EOS
EOS
script
.
flush
script
.
flush
assert_equal
"
\"
test
\"\n\"
fin
\"\n
"
,
`
./bin/mruby
#{
script
.
path
}
`
assert_equal
"
\"
test
\"\n\"
fin
\"\n
"
,
`
#{
cmd
(
'mruby'
)
}
#{
script
.
path
}
`
end
end
mrbgems/mruby-bin-strip/bintest/mruby-strip.rb
View file @
bcd10c71
require
'tempfile'
require
'tempfile'
assert
(
'no files'
)
do
assert
(
'no files'
)
do
o
=
`
bin/mruby-strip
2>&1`
o
=
`
#{
cmd
(
'mruby-strip'
)
}
2>&1`
assert_equal
1
,
$?
.
exitstatus
assert_equal
1
,
$?
.
exitstatus
assert_equal
"no files to strip"
,
o
.
split
(
"
\n
"
)[
0
]
assert_equal
"no files to strip"
,
o
.
split
(
"
\n
"
)[
0
]
end
end
assert
(
'file not found'
)
do
assert
(
'file not found'
)
do
o
=
`
bin/mruby-strip
not_found.mrb 2>&1`
o
=
`
#{
cmd
(
'mruby-strip'
)
}
not_found.mrb 2>&1`
assert_equal
1
,
$?
.
exitstatus
assert_equal
1
,
$?
.
exitstatus
assert_equal
"can't open file for reading not_found.mrb
\n
"
,
o
assert_equal
"can't open file for reading not_found.mrb
\n
"
,
o
end
end
...
@@ -16,7 +16,7 @@ assert('not irep file') do
...
@@ -16,7 +16,7 @@ assert('not irep file') do
t
=
Tempfile
.
new
(
'script.rb'
)
t
=
Tempfile
.
new
(
'script.rb'
)
t
.
write
'p test\n'
t
.
write
'p test\n'
t
.
flush
t
.
flush
o
=
`
bin/mruby-strip
#{
t
.
path
}
2>&1`
o
=
`
#{
cmd
(
'mruby-strip'
)
}
#{
t
.
path
}
2>&1`
assert_equal
1
,
$?
.
exitstatus
assert_equal
1
,
$?
.
exitstatus
assert_equal
"can't read irep file
#{
t
.
path
}
\n
"
,
o
assert_equal
"can't read irep file
#{
t
.
path
}
\n
"
,
o
end
end
...
@@ -26,15 +26,15 @@ assert('success') do
...
@@ -26,15 +26,15 @@ assert('success') do
Tempfile
.
new
(
'script.rb'
),
Tempfile
.
new
(
'c1.mrb'
),
Tempfile
.
new
(
'c2.mrb'
)
Tempfile
.
new
(
'script.rb'
),
Tempfile
.
new
(
'c1.mrb'
),
Tempfile
.
new
(
'c2.mrb'
)
script_file
.
write
"p 'test'
\n
"
script_file
.
write
"p 'test'
\n
"
script_file
.
flush
script_file
.
flush
`
bin/mrbc
-g -o
#{
compiled1
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-g -o
#{
compiled1
.
path
}
#{
script_file
.
path
}
`
`
bin/mrbc
-g -o
#{
compiled2
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-g -o
#{
compiled2
.
path
}
#{
script_file
.
path
}
`
o
=
`
bin/mruby-strip
#{
compiled1
.
path
}
`
o
=
`
#{
cmd
(
'mruby-strip'
)
}
#{
compiled1
.
path
}
`
assert_equal
0
,
$?
.
exitstatus
assert_equal
0
,
$?
.
exitstatus
assert_equal
""
,
o
assert_equal
""
,
o
assert_equal
`
bin/mruby
#{
script_file
.
path
}
`
,
`bin/mruby
-b
#{
compiled1
.
path
}
`
assert_equal
`
#{
cmd
(
'mruby'
)
}
#{
script_file
.
path
}
`
,
`
#{
cmd
(
'mruby'
)
}
-b
#{
compiled1
.
path
}
`
o
=
`
bin/mruby-strip
#{
compiled1
.
path
}
#{
compiled2
.
path
}
`
o
=
`
#{
cmd
(
'mruby-strip'
)
}
#{
compiled1
.
path
}
#{
compiled2
.
path
}
`
assert_equal
0
,
$?
.
exitstatus
assert_equal
0
,
$?
.
exitstatus
assert_equal
""
,
o
assert_equal
""
,
o
end
end
...
@@ -44,12 +44,12 @@ assert('check debug section') do
...
@@ -44,12 +44,12 @@ assert('check debug section') do
Tempfile
.
new
(
'script.rb'
),
Tempfile
.
new
(
'c1.mrb'
),
Tempfile
.
new
(
'c2.mrb'
)
Tempfile
.
new
(
'script.rb'
),
Tempfile
.
new
(
'c1.mrb'
),
Tempfile
.
new
(
'c2.mrb'
)
script_file
.
write
"p 'test'
\n
"
script_file
.
write
"p 'test'
\n
"
script_file
.
flush
script_file
.
flush
`
bin/mrbc
-o
#{
without_debug
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-o
#{
without_debug
.
path
}
#{
script_file
.
path
}
`
`
bin/mrbc
-g -o
#{
with_debug
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-g -o
#{
with_debug
.
path
}
#{
script_file
.
path
}
`
assert_true
with_debug
.
size
>=
without_debug
.
size
assert_true
with_debug
.
size
>=
without_debug
.
size
`
bin/mruby-strip
#{
with_debug
.
path
}
`
`
#{
cmd
(
'mruby-strip'
)
}
#{
with_debug
.
path
}
`
assert_equal
without_debug
.
size
,
with_debug
.
size
assert_equal
without_debug
.
size
,
with_debug
.
size
end
end
...
@@ -62,12 +62,12 @@ a += b
...
@@ -62,12 +62,12 @@ a += b
p Kernel.local_variables
p Kernel.local_variables
EOS
EOS
script_file
.
flush
script_file
.
flush
`
bin/mrbc
-o
#{
with_lv
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-o
#{
with_lv
.
path
}
#{
script_file
.
path
}
`
`
bin/mrbc
-o
#{
without_lv
.
path
}
#{
script_file
.
path
}
`
`
#{
cmd
(
'mrbc'
)
}
-o
#{
without_lv
.
path
}
#{
script_file
.
path
}
`
`
bin/mruby-strip
-l
#{
without_lv
.
path
}
`
`
#{
cmd
(
'mruby-strip'
)
}
-l
#{
without_lv
.
path
}
`
assert_true
without_lv
.
size
<
with_lv
.
size
assert_true
without_lv
.
size
<
with_lv
.
size
assert_equal
'[:a, :b]'
,
`
bin/mruby
-b
#{
with_lv
.
path
}
`
.
chomp
assert_equal
'[:a, :b]'
,
`
#{
cmd
(
'mruby'
)
}
-b
#{
with_lv
.
path
}
`
.
chomp
assert_equal
'[]'
,
`
bin/mruby
-b
#{
without_lv
.
path
}
`
.
chomp
assert_equal
'[]'
,
`
#{
cmd
(
'mruby'
)
}
-b
#{
without_lv
.
path
}
`
.
chomp
end
end
mrbgems/mruby-compiler/bintest/mrbc.rb
View file @
bcd10c71
...
@@ -6,7 +6,7 @@ assert('Compiling multiple files without new line in last line. #2361') do
...
@@ -6,7 +6,7 @@ assert('Compiling multiple files without new line in last line. #2361') do
a
.
flush
a
.
flush
b
.
write
(
'module B; end'
)
b
.
write
(
'module B; end'
)
b
.
flush
b
.
flush
result
=
`
bin/mrbc
-c -o
#{
out
.
path
}
#{
a
.
path
}
#{
b
.
path
}
2>&1`
result
=
`
#{
cmd
(
'mrbc'
)
}
-c -o
#{
out
.
path
}
#{
a
.
path
}
#{
b
.
path
}
2>&1`
assert_equal
"
bin/mrbc
:
#{
a
.
path
}
:Syntax OK"
,
result
.
chomp
assert_equal
"
#{
cmd
(
'mrbc'
)
}
:
#{
a
.
path
}
:Syntax OK"
,
result
.
chomp
assert_equal
0
,
$?
.
exitstatus
assert_equal
0
,
$?
.
exitstatus
end
end
test/bintest.rb
View file @
bcd10c71
$:
.
unshift
File
.
dirname
(
File
.
dirname
(
File
.
expand_path
(
__FILE__
)))
$:
.
unshift
File
.
dirname
(
File
.
dirname
(
File
.
expand_path
(
__FILE__
)))
require
'test/assert.rb'
require
'test/assert.rb'
def
cmd
(
s
)
ENV
[
'SHELL'
]
?
"bin/
#{
s
}
"
:
"bin
\\
#{
s
}
.exe"
end
def
shellquote
(
s
)
ENV
[
'SHELL'
]
?
"'
#{
s
}
'"
:
"
\"
#{
s
}
\"
"
end
ARGV
.
each
do
|
gem
|
ARGV
.
each
do
|
gem
|
Dir
[
"
#{
gem
}
/bintest/**/*.rb"
].
each
do
|
file
|
Dir
[
"
#{
gem
}
/bintest/**/*.rb"
].
each
do
|
file
|
load
file
load
file
...
...
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