Skip to content

Commit 88069f0

Browse files
committed
Fix docs issues.
Update scripts to match latest rubocop. Fix hex length of unity printf feature.
1 parent a7639ee commit 88069f0

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The message is output stating why.
5454

5555
Compare two integers for equality and display errors as signed integers.
5656
A cast will be performed to your natural integer size so often this can just be used.
57-
When you need to specify the exact size, like when comparing arrays, you can use a specific version:
57+
When you need to specify the exact size, you can use a specific version.
5858

5959
TEST_ASSERT_EQUAL_UINT(expected, actual)
6060
TEST_ASSERT_EQUAL_UINT8(expected, actual)
@@ -72,7 +72,8 @@ Like INT, there are variants for different sizes also.
7272
TEST_ASSERT_EQUAL_HEX64(expected, actual)
7373

7474
Compares two integers for equality and display errors as hexadecimal.
75-
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).
75+
Like the other integer comparisons, you can specify the size...
76+
here the size will also effect how many nibbles are shown (for example, `HEX16` will show 4 nibbles).
7677

7778
TEST_ASSERT_EQUAL(expected, actual)
7879

@@ -214,7 +215,8 @@ Fails if the pointer is equal to NULL
214215
TEST_ASSERT_EQUAL_MEMORY(expected, actual, len)
215216

216217
Compare two blocks of memory.
217-
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.
218+
This is a good generic assertion for types that can't be coerced into acting like standard types...
219+
but since it's a memory compare, you have to be careful that your data types are packed.
218220

219221
### \_MESSAGE
220222

auto/generate_module.rb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def files_to_operate_on(module_name, pattern = nil)
155155
path: (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
156156
name: submodule_name,
157157
template: cfg[:template],
158-
test_define: cfg[:test_define]
158+
test_define: cfg[:test_define],
159159
boilerplate: cfg[:boilerplate],
160160
includes: case (cfg[:inc])
161161
when :src then (@options[:includes][:src] || []) | (pattern_traits[:inc].map { |f| format(f, module_name) })
@@ -170,18 +170,19 @@ def files_to_operate_on(module_name, pattern = nil)
170170
end
171171

172172
############################
173-
def neutralize_filename(name, start_cap = true)
173+
def neutralize_filename(name, start_cap: true)
174174
return name if name.empty?
175+
175176
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map(&:capitalize).join('_')
176-
name = name[0].downcase + name[1..-1] unless start_cap
177+
name = name[0].downcase + name[1..] unless start_cap
177178
name
178179
end
179180

180181
############################
181182
def create_filename(part1, part2 = '')
182-
name = part2.empty? ? part1 : part1 + '_' + part2
183+
name = part2.empty? ? part1 : "#{part1}_#{part2}"
183184
case (@options[:naming])
184-
when 'bumpy' then neutralize_filename(name, false).delete('_')
185+
when 'bumpy' then neutralize_filename(name, start_cap: false).delete('_')
185186
when 'camel' then neutralize_filename(name).delete('_')
186187
when 'snake' then neutralize_filename(name).downcase
187188
when 'caps' then neutralize_filename(name).upcase
@@ -263,12 +264,12 @@ def destroy(module_name, pattern = nil)
263264
case arg
264265
when /^-d/ then destroy = true
265266
when /^-u/ then options[:update_svn] = true
266-
when /^-p\"?(\w+)\"?/ then options[:pattern] = Regexp.last_match(1)
267-
when /^-s\"?(.+)\"?/ then options[:path_src] = Regexp.last_match(1)
268-
when /^-i\"?(.+)\"?/ then options[:path_inc] = Regexp.last_match(1)
269-
when /^-t\"?(.+)\"?/ then options[:path_tst] = Regexp.last_match(1)
270-
when /^-n\"?(.+)\"?/ then options[:naming] = Regexp.last_match(1)
271-
when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
267+
when /^-p"?(\w+)"?/ then options[:pattern] = Regexp.last_match(1)
268+
when /^-s"?(.+)"?/ then options[:path_src] = Regexp.last_match(1)
269+
when /^-i"?(.+)"?/ then options[:path_inc] = Regexp.last_match(1)
270+
when /^-t"?(.+)"?/ then options[:path_tst] = Regexp.last_match(1)
271+
when /^-n"?(.+)"?/ then options[:naming] = Regexp.last_match(1)
272+
when /^-y"?(.+)"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
272273
when /^(\w+)/
273274
raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
274275

src/unity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,15 +2029,15 @@ static void UnityPrintFVA(const char* format, va_list va)
20292029
UNITY_EXTRACT_ARG(UNITY_UINT, number, length_mod, va, unsigned int);
20302030
UNITY_OUTPUT_CHAR('0');
20312031
UNITY_OUTPUT_CHAR('x');
2032-
UnityPrintNumberHex(number, 8);
2032+
UnityPrintNumberHex(number, UNITY_MAX_NIBBLES);
20332033
break;
20342034
}
20352035
case 'p':
20362036
{
20372037
const unsigned int number = va_arg(va, unsigned int);
20382038
UNITY_OUTPUT_CHAR('0');
20392039
UNITY_OUTPUT_CHAR('x');
2040-
UnityPrintNumberHex((UNITY_UINT)number, 8);
2040+
UnityPrintNumberHex((UNITY_UINT)number, UNITY_MAX_NIBBLES);
20412041
break;
20422042
}
20432043
case 'c':

0 commit comments

Comments
 (0)