mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-19 07:18:10 +08:00
Fix docs issues.
Update scripts to match latest rubocop. Fix hex length of unity printf feature.
This commit is contained in:
@@ -54,7 +54,7 @@ The message is output stating why.
|
||||
|
||||
Compare two integers for equality and display errors as signed integers.
|
||||
A cast will be performed to your natural integer size so often this can just be used.
|
||||
When you need to specify the exact size, like when comparing arrays, you can use a specific version:
|
||||
When you need to specify the exact size, you can use a specific version.
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT(expected, actual)
|
||||
TEST_ASSERT_EQUAL_UINT8(expected, actual)
|
||||
@@ -72,7 +72,8 @@ Like INT, there are variants for different sizes also.
|
||||
TEST_ASSERT_EQUAL_HEX64(expected, actual)
|
||||
|
||||
Compares two integers for equality and display errors as hexadecimal.
|
||||
Like the other integer comparisons, you can specify the size... here the size will also effect how many nibbles are shown (for example, `HEX16` will show 4 nibbles).
|
||||
Like the other integer comparisons, you can specify the size...
|
||||
here the size will also effect how many nibbles are shown (for example, `HEX16` will show 4 nibbles).
|
||||
|
||||
TEST_ASSERT_EQUAL(expected, actual)
|
||||
|
||||
@@ -214,7 +215,8 @@ Fails if the pointer is equal to NULL
|
||||
TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)
|
||||
|
||||
Compare two blocks of memory.
|
||||
This is a good generic assertion for types that can't be coerced into acting like standard types... but since it's a memory compare, you have to be careful that your data types are packed.
|
||||
This is a good generic assertion for types that can't be coerced into acting like standard types...
|
||||
but since it's a memory compare, you have to be careful that your data types are packed.
|
||||
|
||||
### \_MESSAGE
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class UnityModuleGenerator
|
||||
path: (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
|
||||
name: submodule_name,
|
||||
template: cfg[:template],
|
||||
test_define: cfg[:test_define]
|
||||
test_define: cfg[:test_define],
|
||||
boilerplate: cfg[:boilerplate],
|
||||
includes: case (cfg[:inc])
|
||||
when :src then (@options[:includes][:src] || []) | (pattern_traits[:inc].map { |f| format(f, module_name) })
|
||||
@@ -170,18 +170,19 @@ class UnityModuleGenerator
|
||||
end
|
||||
|
||||
############################
|
||||
def neutralize_filename(name, start_cap = true)
|
||||
def neutralize_filename(name, start_cap: true)
|
||||
return name if name.empty?
|
||||
|
||||
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map(&:capitalize).join('_')
|
||||
name = name[0].downcase + name[1..-1] unless start_cap
|
||||
name = name[0].downcase + name[1..] unless start_cap
|
||||
name
|
||||
end
|
||||
|
||||
############################
|
||||
def create_filename(part1, part2 = '')
|
||||
name = part2.empty? ? part1 : part1 + '_' + part2
|
||||
name = part2.empty? ? part1 : "#{part1}_#{part2}"
|
||||
case (@options[:naming])
|
||||
when 'bumpy' then neutralize_filename(name, false).delete('_')
|
||||
when 'bumpy' then neutralize_filename(name, start_cap: false).delete('_')
|
||||
when 'camel' then neutralize_filename(name).delete('_')
|
||||
when 'snake' then neutralize_filename(name).downcase
|
||||
when 'caps' then neutralize_filename(name).upcase
|
||||
@@ -263,12 +264,12 @@ if $0 == __FILE__
|
||||
case arg
|
||||
when /^-d/ then destroy = true
|
||||
when /^-u/ then options[:update_svn] = true
|
||||
when /^-p\"?(\w+)\"?/ then options[:pattern] = Regexp.last_match(1)
|
||||
when /^-s\"?(.+)\"?/ then options[:path_src] = Regexp.last_match(1)
|
||||
when /^-i\"?(.+)\"?/ then options[:path_inc] = Regexp.last_match(1)
|
||||
when /^-t\"?(.+)\"?/ then options[:path_tst] = Regexp.last_match(1)
|
||||
when /^-n\"?(.+)\"?/ then options[:naming] = Regexp.last_match(1)
|
||||
when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
|
||||
when /^-p"?(\w+)"?/ then options[:pattern] = Regexp.last_match(1)
|
||||
when /^-s"?(.+)"?/ then options[:path_src] = Regexp.last_match(1)
|
||||
when /^-i"?(.+)"?/ then options[:path_inc] = Regexp.last_match(1)
|
||||
when /^-t"?(.+)"?/ then options[:path_tst] = Regexp.last_match(1)
|
||||
when /^-n"?(.+)"?/ then options[:naming] = Regexp.last_match(1)
|
||||
when /^-y"?(.+)"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
|
||||
when /^(\w+)/
|
||||
raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
|
||||
|
||||
|
||||
@@ -2029,7 +2029,7 @@ static void UnityPrintFVA(const char* format, va_list va)
|
||||
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
|
||||
UNITY_OUTPUT_CHAR('0');
|
||||
UNITY_OUTPUT_CHAR('x');
|
||||
UnityPrintNumberHex(number, 8);
|
||||
UnityPrintNumberHex(number, UNITY_MAX_NIBBLES);
|
||||
break;
|
||||
}
|
||||
case 'p':
|
||||
@@ -2037,7 +2037,7 @@ static void UnityPrintFVA(const char* format, va_list va)
|
||||
const unsigned int number = va_arg(va, unsigned int);
|
||||
UNITY_OUTPUT_CHAR('0');
|
||||
UNITY_OUTPUT_CHAR('x');
|
||||
UnityPrintNumberHex((UNITY_UINT)number, 8);
|
||||
UnityPrintNumberHex((UNITY_UINT)number, UNITY_MAX_NIBBLES);
|
||||
break;
|
||||
}
|
||||
case 'c':
|
||||
|
||||
Reference in New Issue
Block a user