Ad
  • Custom User Avatar

    Could someone here easily fix that?

  • Custom User Avatar

    That's a good idea. I'll add it.

  • Custom User Avatar

    I'm glad you were able to solve it!

  • Custom User Avatar

    First, I didn't realize this was coffeescript you were failing on, in case that matters.

    I just tested it under coffeescript, with my solution but adding your if block to the top. It consistently finishes within a second or two, both under "My Test Fixtures" and when submitting the code. I have never had a time out. It's not my kata or tests.

    Can you reproduce the timeout if you only have the if block in your function? In other words, if this is all that you submit:

    parseCSV = (input, separator, quote) ->
      if !input
        return [[""]]
    

    If that works consistently (ie: the first test passes every time), then the error still must be within your code somewhere.

    Sorry, I don't know what else to suggest. :-\

  • Custom User Avatar

    I just tested it, it worked fine for me. Simply throwing this into the top of Your Test Fixtures should show this:

    Test.assertSimilar(parseCSV(""), [['']]);
    

    I tested it against my code several times, and had no timeouts. My guess is that it's just a coincidence.

    If you are still having issues, then most likely your algorithm has something that's getting stuck in an infinite loop. One thing that might help is to add a counter to one or more of your loops, and break out if the counter exceeds some rational number, like 50. You can then use console.log() to check on your variables and see if something is getting stuck.