Ad
  • Custom User Avatar

    The JavaScript tests have been updated.

  • Default User Avatar

    The JS version of this kata needs more tests. A member of my team was able to write a solution that worked for the given tests, but not generically.

    Some additional tests to make:

    // Use less than all of the comment markers
    checkComments("apples, plums\npears % and bananas\noranges", ["%", "!"], "apples, plums\npears\noranges")
    // Test with more than two comment markers
    checkComments("apples, plums % these are round\npears ! and bananas\noranges # no lemons", ["%", "!", '#'], "apples, plums\npears\noranges")
    // Test input with more than one comment per marker in the input
    checkComments("apples, plums % these are round\npears ! and bananas\noranges % no lemons", ["%", "!"], "apples, plums\npears\noranges")
    // Test multiple comment markers per line
    checkComments("apples, plums % these are round!\npears !and bananas!\noranges", ["%", "!"], "apples, plums\npears\noranges")
    // Test input with no comments
    checkComments("apples, plums\npears\noranges", ["%", "!"], "apples, plums\npears\noranges")
    // Test input that doesn't end with a comment on the last line
    checkComments("apples, plums % and bananas\npears !applesauce\noranges", ["%", "!"], "apples, plums\npears\noranges")
    // If whitespace is allowed at the front of the line, ensure it isn't removed.
    checkComments("apples, plums % and bananas\n    pears\n\toranges !applesauce", ["%", "!"], "apples, plums\n    pears\n\toranges")
    

    My team member's "solution" passed the current tests, but would have failed all of these.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Very nice minimal code although a bit hard for a human to read. Nicely done though!