require File.expand_path(File.dirname(__FILE__) + '/edgecase') class AboutStrings < EdgeCase::Koan def test_double_quoted_strings_are_strings string = "Hello, World" assert_equal __(true), string.is_a?(String) end def test_single_quoted_strings_are_also_strings string = 'Goodbye, World' assert_equal __(true), string.is_a?(String) end def test_use_single_quotes_to_create_string_with_double_quotes string = 'He said, "Go Away."' assert_equal __('He said, "Go Away."'), string end def test_use_double_quotes_to_create_strings_with_single_quotes string = "Don't" assert_equal __("Don't"), string end def test_use_backslash_for_those_hard_cases a = "He said, \"Don't\"" b = 'He said, "Don\'t"' assert_equal __(true), a == b end def test_use_flexible_quoting_to_handle_really_hard_cases a = %(flexible quotes can handle both ' and " characters) b = %!flexible quotes can handle both ' and " characters! c = %{flexible quotes can handle both ' and " characters} assert_equal __(true), a == b assert_equal __(true), a == c end def test_flexible_quotes_can_handle_multiple_lines long_string = %{ It was the best of times, It was the worst of times. } assert_equal __(54), long_string.length assert_equal __(3), long_string.lines.count end def test_here_documents_can_also_handle_multiple_lines long_string = <