Class: BashCommentFormatterTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/hash_delegator.rb

Instance Method Summary collapse

Instance Method Details

#test_format_empty_stringObject

Test formatting an empty string



6164
6165
6166
6167
6168
# File 'lib/hash_delegator.rb', line 6164

def test_format_empty_string
  input = ''
  expected = '# '
  assert_equal expected, BashCommentFormatter.format_comment(input)
end

#test_format_multi_line_stringObject

Test formatting a multi-line string



6171
6172
6173
6174
6175
# File 'lib/hash_delegator.rb', line 6171

def test_format_multi_line_string
  input = "This is the first line.\nThis is the second line."
  expected = "# This is the first line.\n# This is the second line."
  assert_equal expected, BashCommentFormatter.format_comment(input)
end

#test_format_simple_stringObject

Test formatting a normal string without special characters



6150
6151
6152
6153
6154
# File 'lib/hash_delegator.rb', line 6150

def test_format_simple_string
  input = 'This is a simple comment.'
  expected = '# This is a simple comment.'
  assert_equal expected, BashCommentFormatter.format_comment(input)
end

#test_format_string_with_hashObject

Test formatting a string containing hash characters



6157
6158
6159
6160
6161
# File 'lib/hash_delegator.rb', line 6157

def test_format_string_with_hash
  input = 'This is a #comment with hash.'
  expected = '# This is a \\#comment with hash.'
  assert_equal expected, BashCommentFormatter.format_comment(input)
end

#test_format_whitespaceObject

Test formatting strings with leading and trailing whitespace



6178
6179
6180
6181
6182
# File 'lib/hash_delegator.rb', line 6178

def test_format_whitespace
  input = '  This has leading and trailing spaces  '
  expected = '#   This has leading and trailing spaces  '
  assert_equal expected, BashCommentFormatter.format_comment(input)
end