Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
58be52f0
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
36
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
58be52f0
编写于
11月 28, 2018
作者:
M
Mark VanderVoord
提交者:
GitHub
11月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #374 from jlindgren90/rubocop
Fix (most) Rubocop warnings. (Thanks @jlindgren90 !!!!)
上级
28bf7954
5cd1c33b
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
73 addition
and
92 deletion
+73
-92
auto/colour_prompt.rb
auto/colour_prompt.rb
+2
-2
auto/colour_reporter.rb
auto/colour_reporter.rb
+1
-1
auto/generate_module.rb
auto/generate_module.rb
+3
-5
auto/generate_test_runner.rb
auto/generate_test_runner.rb
+3
-5
auto/parse_output.rb
auto/parse_output.rb
+28
-29
auto/stylize_as_junit.rb
auto/stylize_as_junit.rb
+4
-8
auto/test_file_filter.rb
auto/test_file_filter.rb
+2
-2
auto/unity_test_summary.rb
auto/unity_test_summary.rb
+0
-4
examples/example_3/rakefile.rb
examples/example_3/rakefile.rb
+4
-7
examples/example_3/rakefile_helper.rb
examples/example_3/rakefile_helper.rb
+4
-4
extras/fixture/rakefile.rb
extras/fixture/rakefile.rb
+6
-8
extras/fixture/rakefile_helper.rb
extras/fixture/rakefile_helper.rb
+8
-8
test/.rubocop.yml
test/.rubocop.yml
+1
-1
test/rakefile
test/rakefile
+3
-4
test/rakefile_helper.rb
test/rakefile_helper.rb
+4
-4
未找到文件。
auto/colour_prompt.rb
浏览文件 @
58be52f0
...
...
@@ -24,7 +24,7 @@ class ColourCommandLine
return
unless
RUBY_PLATFORM
=~
/(win|w)32$/
get_std_handle
=
Win32API
.
new
(
'kernel32'
,
'GetStdHandle'
,
[
'L'
],
'L'
)
@set_console_txt_attrb
=
Win32API
.
new
(
'kernel32'
,
'SetConsoleTextAttribute'
,
%w
(L N)
,
'I'
)
Win32API
.
new
(
'kernel32'
,
'SetConsoleTextAttribute'
,
%w
[L N]
,
'I'
)
@hout
=
get_std_handle
.
call
(
-
11
)
end
...
...
@@ -107,7 +107,7 @@ class ColourCommandLine
$stdout
.
print
(
"
#{
change_to
(
colour
)
}#{
str
}
\033
[0m"
)
if
mode
==
:print
end
end
end
# ColourCommandLine
end
def
colour_puts
(
role
,
str
)
ColourCommandLine
.
new
.
out_c
(
:puts
,
role
,
str
)
...
...
auto/colour_reporter.rb
浏览文件 @
58be52f0
...
...
@@ -4,7 +4,7 @@
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
require
"
#{
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
}
/colour_prompt"
require
_relative
'colour_prompt'
$colour_output
=
true
...
...
auto/generate_module.rb
浏览文件 @
58be52f0
...
...
@@ -45,8 +45,6 @@ TEMPLATE_INC ||= '#ifndef _%3$s_H
class
UnityModuleGenerator
############################
def
initialize
(
options
=
nil
)
here
=
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
+
'/'
@options
=
UnityModuleGenerator
.
default_options
case
options
when
NilClass
then
@options
...
...
@@ -56,9 +54,9 @@ class UnityModuleGenerator
end
# Create default file paths if none were provided
@options
[
:path_src
]
=
here
+
'../src/'
if
@options
[
:path_src
].
nil?
@options
[
:path_inc
]
=
@options
[
:path_src
]
if
@options
[
:path_inc
].
nil?
@options
[
:path_tst
]
=
here
+
'../test/'
if
@options
[
:path_tst
].
nil?
@options
[
:path_src
]
=
"
#{
__dir__
}
/../src/"
if
@options
[
:path_src
].
nil?
@options
[
:path_inc
]
=
@options
[
:path_src
]
if
@options
[
:path_inc
].
nil?
@options
[
:path_tst
]
=
"
#{
__dir__
}
/../test/"
if
@options
[
:path_tst
].
nil?
@options
[
:path_src
]
+=
'/'
unless
@options
[
:path_src
][
-
1
]
==
47
@options
[
:path_inc
]
+=
'/'
unless
@options
[
:path_inc
][
-
1
]
==
47
@options
[
:path_tst
]
+=
'/'
unless
@options
[
:path_tst
][
-
1
]
==
47
...
...
auto/generate_test_runner.rb
浏览文件 @
58be52f0
...
...
@@ -4,8 +4,6 @@
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'colour_prompt'
))
class
UnityTestRunnerGenerator
def
initialize
(
options
=
nil
)
@options
=
UnityTestRunnerGenerator
.
default_options
...
...
@@ -15,7 +13,7 @@ class UnityTestRunnerGenerator
when
Hash
then
@options
.
merge!
(
options
)
else
raise
'If you specify arguments, it should be a filename or a hash of options'
end
require
"
#{
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
}
/type_sanitizer"
require
_relative
'type_sanitizer'
end
def
self
.
default_options
...
...
@@ -165,7 +163,7 @@ class UnityTestRunnerGenerator
output
.
puts
(
'#include "cmock.h"'
)
unless
mocks
.
empty?
output
.
puts
(
'#ifndef UNITY_EXCLUDE_SETJMP_H'
)
output
.
puts
(
'#include <setjmp.h>'
)
output
.
puts
(
"#endif"
)
output
.
puts
(
'#endif'
)
output
.
puts
(
'#include <stdio.h>'
)
if
@options
[
:defines
]
&&
!
@options
[
:defines
].
empty?
@options
[
:defines
].
each
{
|
d
|
output
.
puts
(
"#define
#{
d
}
"
)
}
...
...
@@ -379,7 +377,7 @@ class UnityTestRunnerGenerator
end
output
.
puts
output
.
puts
(
' CMock_Guts_MemFreeFinal();'
)
unless
used_mocks
.
empty?
output
.
puts
(
" return suite_teardown(UnityEnd());"
)
output
.
puts
(
' return suite_teardown(UnityEnd());'
)
output
.
puts
(
'}'
)
end
...
...
auto/parse_output.rb
浏览文件 @
58be52f0
...
...
@@ -210,7 +210,7 @@ class ParseOutput
# Adjusts the os specific members according to the current path style
# (Windows or Unix based)
def
se
t_os_specifics
(
line
)
def
detec
t_os_specifics
(
line
)
if
line
.
include?
'\\'
# Windows X:\Y\Z
@class_name_idx
=
1
...
...
@@ -254,43 +254,42 @@ class ParseOutput
# TEST(<test_group, <test_file>) PASS
#
# Note: Where path is different on Unix vs Windows devices (Windows leads with a drive letter)!
se
t_os_specifics
(
line
)
detec
t_os_specifics
(
line
)
line_array
=
line
.
split
(
':'
)
# If we were able to split the line then we can look to see if any of our target words
# were found. Case is important.
if
(
line_array
.
size
>=
4
)
||
(
line
.
start_with?
'TEST('
)
||
(
line
.
start_with?
'IGNORE_TEST('
)
# check if the output is fixture output (with verbose flag "-v")
if
(
line
.
start_with?
'TEST('
)
||
(
line
.
start_with?
'IGNORE_TEST('
)
line_array
=
prepare_fixture_line
(
line
)
if
line
.
include?
' PASS'
test_passed_unity_fixture
(
line_array
)
@test_passed
+=
1
elsif
line
.
include?
'FAIL'
test_failed_unity_fixture
(
line_array
)
@test_failed
+=
1
elsif
line
.
include?
'IGNORE'
test_ignored_unity_fixture
(
line_array
)
@test_ignored
+=
1
end
# normal output / fixture output (without verbose "-v")
elsif
line
.
include?
':PASS'
test_passed
(
line_array
)
next
unless
(
line_array
.
size
>=
4
)
||
(
line
.
start_with?
'TEST('
)
||
(
line
.
start_with?
'IGNORE_TEST('
)
# check if the output is fixture output (with verbose flag "-v")
if
(
line
.
start_with?
'TEST('
)
||
(
line
.
start_with?
'IGNORE_TEST('
)
line_array
=
prepare_fixture_line
(
line
)
if
line
.
include?
' PASS'
test_passed_unity_fixture
(
line_array
)
@test_passed
+=
1
elsif
line
.
include?
'
:
FAIL'
test_failed
(
line_array
)
elsif
line
.
include?
'FAIL'
test_failed
_unity_fixture
(
line_array
)
@test_failed
+=
1
elsif
line
.
include?
':IGNORE:'
test_ignored
(
line_array
)
@test_ignored
+=
1
elsif
line
.
include?
':IGNORE'
line_array
.
push
(
'No reason given'
)
test_ignored
(
line_array
)
elsif
line
.
include?
'IGNORE'
test_ignored_unity_fixture
(
line_array
)
@test_ignored
+=
1
end
@total_tests
=
@test_passed
+
@test_failed
+
@test_ignored
# normal output / fixture output (without verbose "-v")
elsif
line
.
include?
':PASS'
test_passed
(
line_array
)
@test_passed
+=
1
elsif
line
.
include?
':FAIL'
test_failed
(
line_array
)
@test_failed
+=
1
elsif
line
.
include?
':IGNORE:'
test_ignored
(
line_array
)
@test_ignored
+=
1
elsif
line
.
include?
':IGNORE'
line_array
.
push
(
'No reason given'
)
test_ignored
(
line_array
)
@test_ignored
+=
1
end
@total_tests
=
@test_passed
+
@test_failed
+
@test_ignored
end
puts
''
puts
'=================== SUMMARY ====================='
...
...
auto/stylize_as_junit.rb
浏览文件 @
58be52f0
...
...
@@ -61,8 +61,8 @@ class ArgvParser
opts
.
parse!
(
args
)
options
end
# parse()
end
# class OptparseExample
end
end
class
UnityToJUnit
include
FileUtils
::
Verbose
...
...
@@ -155,10 +155,6 @@ class UnityToJUnit
[
Regexp
.
last_match
(
1
).
to_i
,
Regexp
.
last_match
(
2
).
to_i
,
Regexp
.
last_match
(
3
).
to_i
]
end
def
here
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
end
private
def
results_structure
...
...
@@ -221,9 +217,9 @@ class UnityToJUnit
def
write_suites_footer
(
stream
)
stream
.
puts
'</testsuites>'
end
end
# UnityToJUnit
end
if
__FILE__
==
$0
if
$0
==
__FILE__
# parse out the command options
options
=
ArgvParser
.
parse
(
ARGV
)
...
...
auto/test_file_filter.rb
浏览文件 @
58be52f0
...
...
@@ -11,8 +11,8 @@ module RakefileHelpers
def
initialize
(
all_files
=
false
)
@all_files
=
all_files
return
false
unless
@all_files
return
false
unless
File
.
exist?
(
'test_file_filter.yml'
)
return
unless
@all_files
return
unless
File
.
exist?
(
'test_file_filter.yml'
)
filters
=
YAML
.
load_file
(
'test_file_filter.yml'
)
@all_files
=
filters
[
:all_files
]
...
...
auto/unity_test_summary.rb
浏览文件 @
58be52f0
...
...
@@ -101,10 +101,6 @@ class UnityTestSummary
raise
"Couldn't parse test results:
#{
summary
}
"
unless
summary
.
find
{
|
v
|
v
=~
/(\d+) Tests (\d+) Failures (\d+) Ignored/
}
[
Regexp
.
last_match
(
1
).
to_i
,
Regexp
.
last_match
(
2
).
to_i
,
Regexp
.
last_match
(
3
).
to_i
]
end
def
here
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
end
end
if
$0
==
__FILE__
...
...
examples/example_3/rakefile.rb
浏览文件 @
58be52f0
HERE
=
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
+
'/'
UNITY_ROOT
=
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
+
'/../..'
require
'rake'
require
'rake/clean'
require
HERE
+
'rakefile_helper'
require
_relative
'rakefile_helper'
TEMP_DIRS
=
[
File
.
join
(
HERE
,
'build'
)
File
.
join
(
__dir__
,
'build'
)
].
freeze
TEMP_DIRS
.
each
do
|
dir
|
...
...
@@ -32,8 +29,8 @@ task :summary do
end
desc
'Build and test Unity'
task
all:
%i
(clean unit summary)
task
default:
%i
(clobber all)
task
all:
%i
[clean unit summary]
task
default:
%i
[clobber all]
task
ci:
[
:default
]
task
cruise:
[
:default
]
...
...
examples/example_3/rakefile_helper.rb
浏览文件 @
58be52f0
require
'yaml'
require
'fileutils'
require
UNITY_ROOT
+
'
/auto/unity_test_summary'
require
UNITY_ROOT
+
'
/auto/generate_test_runner'
require
UNITY_ROOT
+
'
/auto/colour_reporter'
require
_relative
'../..
/auto/unity_test_summary'
require
_relative
'../..
/auto/generate_test_runner'
require
_relative
'../..
/auto/colour_reporter'
module
RakefileHelpers
C_EXTENSION
=
'.c'
.
freeze
...
...
@@ -149,7 +149,7 @@ module RakefileHelpers
def
report_summary
summary
=
UnityTestSummary
.
new
summary
.
root
=
HERE
summary
.
root
=
__dir__
results_glob
=
"
#{
$cfg
[
'compiler'
][
'build_path'
]
}
*.test*"
results_glob
.
tr!
(
'\\'
,
'/'
)
results
=
Dir
[
results_glob
]
...
...
extras/fixture/rakefile.rb
浏览文件 @
58be52f0
...
...
@@ -4,15 +4,13 @@
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
HERE
=
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
+
'/'
require
'rake'
require
'rake/clean'
require
'rake/testtask'
require
HERE
+
'rakefile_helper'
require
_relative
'rakefile_helper'
TEMP_DIRS
=
[
File
.
join
(
HERE
,
'build'
)
File
.
join
(
__dir__
,
'build'
)
].
freeze
TEMP_DIRS
.
each
do
|
dir
|
...
...
@@ -33,10 +31,10 @@ task unit: [:prepare_for_tests] do
end
desc
'Build and test Unity Framework'
task
all:
%i
(clean unit)
task
default:
%i
(clobber all)
task
ci:
%i
(no_color default)
task
cruise:
%i
(no_color default)
task
all:
%i
[clean unit]
task
default:
%i
[clobber all]
task
ci:
%i
[no_color default]
task
cruise:
%i
[no_color default]
desc
'Load configuration'
task
:config
,
:config_file
do
|
_t
,
args
|
...
...
extras/fixture/rakefile_helper.rb
浏览文件 @
58be52f0
...
...
@@ -6,9 +6,9 @@
require
'yaml'
require
'fileutils'
require
HERE
+
'../../auto/unity_test_summary'
require
HERE
+
'../../auto/generate_test_runner'
require
HERE
+
'../../auto/colour_reporter'
require
_relative
'../../auto/unity_test_summary'
require
_relative
'../../auto/generate_test_runner'
require
_relative
'../../auto/colour_reporter'
module
RakefileHelpers
C_EXTENSION
=
'.c'
.
freeze
...
...
@@ -16,7 +16,7 @@ module RakefileHelpers
def
load_configuration
(
config_file
)
return
if
$configured
$cfg_file
=
HERE
+
"
../../test/targets/
#{
config_file
}
"
unless
config_file
=~
/[\\|\/]/
$cfg_file
=
"
#{
__dir__
}
/
../../test/targets/
#{
config_file
}
"
unless
config_file
=~
/[\\|\/]/
$cfg
=
YAML
.
load
(
File
.
read
(
$cfg_file
))
$colour_output
=
false
unless
$cfg
[
'colour'
]
$configured
=
true
if
config_file
!=
DEFAULT_CONFIG_FILE
...
...
@@ -128,7 +128,7 @@ module RakefileHelpers
def
report_summary
summary
=
UnityTestSummary
.
new
summary
.
root
=
HERE
summary
.
root
=
__dir__
results_glob
=
"
#{
$cfg
[
'compiler'
][
'build_path'
]
}
*.test*"
results_glob
.
tr!
(
'\\'
,
'/'
)
results
=
Dir
[
results_glob
]
...
...
@@ -145,9 +145,9 @@ module RakefileHelpers
$cfg
[
'compiler'
][
'defines'
][
'items'
]
=
[]
if
$cfg
[
'compiler'
][
'defines'
][
'items'
].
nil?
# Get a list of all source files needed
src_files
=
Dir
[
HERE
+
'src/*.c'
]
src_files
+=
Dir
[
HERE
+
'test/*.c'
]
src_files
+=
Dir
[
HERE
+
'test/main/*.c'
]
src_files
=
Dir
[
"
#{
__dir__
}
/src/*.c"
]
src_files
+=
Dir
[
"
#{
__dir__
}
/test/*.c"
]
src_files
+=
Dir
[
"
#{
__dir__
}
/test/main/*.c"
]
src_files
<<
'../../src/unity.c'
# Build object files
...
...
test/.rubocop.yml
浏览文件 @
58be52f0
...
...
@@ -18,7 +18,7 @@ Style/HashSyntax:
EnforcedStyle
:
no_mixed_keys
# This is disabled because it seems to get confused over nested hashes
Style
/AlignHash
:
Layout
/AlignHash
:
Enabled
:
false
EnforcedHashRocketStyle
:
table
EnforcedColonStyle
:
table
...
...
test/rakefile
浏览文件 @
58be52f0
...
...
@@ -4,17 +4,16 @@
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
UNITY_ROOT
=
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
+
'/'
$verbose
=
false
require
'rake'
require
'rake/clean'
require
UNITY_ROOT
+
'rakefile_helper'
require
_relative
'rakefile_helper'
require
'rspec/core/rake_task'
TEMP_DIRS
=
[
File
.
join
(
UNITY_ROOT
,
'build'
),
File
.
join
(
UNITY_ROOT
,
'sandbox'
)
File
.
join
(
__dir__
,
'build'
),
File
.
join
(
__dir__
,
'sandbox'
)
]
TEMP_DIRS
.
each
do
|
dir
|
...
...
test/rakefile_helper.rb
浏览文件 @
58be52f0
...
...
@@ -6,9 +6,9 @@
require
'yaml'
require
'fileutils'
require
UNITY_ROOT
+
'../auto/unity_test_summary'
require
UNITY_ROOT
+
'../auto/generate_test_runner'
require
UNITY_ROOT
+
'../auto/colour_reporter'
require
_relative
'../auto/unity_test_summary'
require
_relative
'../auto/generate_test_runner'
require
_relative
'../auto/colour_reporter'
module
RakefileHelpers
C_EXTENSION
=
'.c'
.
freeze
...
...
@@ -179,7 +179,7 @@ module RakefileHelpers
def
report_summary
summary
=
UnityTestSummary
.
new
summary
.
root
=
UNITY_ROOT
summary
.
root
=
__dir__
results_glob
=
"
#{
$cfg
[
'compiler'
][
'build_path'
]
}
*.test*"
results_glob
.
tr!
(
'\\'
,
'/'
)
results
=
Dir
[
results_glob
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录