in reply to Re^4: inconistent test results when using is_deeply to test an array returned from a function
in thread inconistent test results when using is_deeply to test an array returned from a function

Brilliant - thank you.

I was investigating along those lines but my syntax to sort the arrays wasn't up to it, not quite sure I understand why just yet:

is_deeply(sort(\@got_files), sort(\@expected_files), 'Function should return a list of directory contents that will be processed');

However, your suggested syntax does the job:

is_deeply([sort @got_files], [sort @expected_files], 'Function should return a list of directory contents that will be processed');
  • Comment on Re^5: inconistent test results when using is_deeply to test an array returned from a function
  • Select or Download Code

Replies are listed 'Best First'.
Re^6: inconistent test results when using is_deeply to test an array returned from a function
by kennethk (Abbot) on Sep 25, 2014 at 17:38 UTC

    When you say sort(\@got_files), sort sees a one-element list that contains an array reference. Since you want to sort the array, you have to pass sort the list, not a reference that contains it. HTH.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Yes, that makes sense. Many thanks.