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



6268
6269
6270
6271
6272
# File 'lib/hash_delegator.rb', line 6268

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



6275
6276
6277
6278
6279
# File 'lib/hash_delegator.rb', line 6275

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



6254
6255
6256
6257
6258
# File 'lib/hash_delegator.rb', line 6254

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



6261
6262
6263
6264
6265
# File 'lib/hash_delegator.rb', line 6261

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



6282
6283
6284
6285
6286
# File 'lib/hash_delegator.rb', line 6282

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