Files
Unity/test/spec/generate_module_naming_spec.rb
Michael KarleskyandClaude Opus 5.5 f03f932b68 Match module naming conventions to their help text
bumpy produced camelCase and camel produced BumpyCase, the reverse of
the help text. A convention given as a symbol, as YAML configuration
supplies it, was ignored. The Subversion add check read $! where it
needed $?, the exit status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 14:25:38 -04:00

39 lines
1.3 KiB
Ruby

# =========================================================================
# Unity - A Test Framework for C
# ThrowTheSwitch.org
# Copyright (c) 2007-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require '../auto/generate_module.rb'
# Each naming convention produces the case its help text names, whether the
# convention arrives as a string or, from YAML, as a symbol
describe 'UnityModuleGenerator naming' do
def filename(naming, name = 'mad_science')
UnityModuleGenerator.new(naming: naming).create_filename(name)
end
it 'makes bumpy names start with a capital' do
expect(filename('bumpy')).to eq('MadScience')
end
it 'makes camel names start with a lowercase letter' do
expect(filename('camel')).to eq('madScience')
end
it 'makes snake and caps names' do
expect(filename('snake', 'MadScience')).to eq('mad_science')
expect(filename('caps', 'MadScience')).to eq('MAD_SCIENCE')
end
it 'accepts a convention given as a symbol' do
expect(filename(:bumpy)).to eq('MadScience')
expect(filename(:snake, 'MadScience')).to eq('mad_science')
end
it 'keeps a name as given without a convention' do
expect(filename(nil, 'MadScience')).to eq('MadScience')
end
end