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



2536
2537
2538
2539
2540
# File 'lib/hash_delegator.rb', line 2536

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



2543
2544
2545
2546
2547
# File 'lib/hash_delegator.rb', line 2543

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



2522
2523
2524
2525
2526
# File 'lib/hash_delegator.rb', line 2522

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



2529
2530
2531
2532
2533
# File 'lib/hash_delegator.rb', line 2529

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



2550
2551
2552
2553
2554
# File 'lib/hash_delegator.rb', line 2550

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