Tests: array_diff_uassoc version 45

Function:
Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Elements are compared by user supplied function.
Version:
Status: current
Date: 2012-04-19 04:04
Summary: Copying in first test.
Programmer: jj5
Tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function array_diff_uassoc_tests() {

  // API reference: http://docs.jquery.com/QUnit
  module( "array_diff_uassoc" );

  test( "array_diff_uassoc", function() {

    var a1 = { "a": "green", "b": "brown", "c": "blue", 0: "red" };
    var a2 = { "a": "GREEN", "B": "brown", 0: "yellow", 1: "red" );

    var diff = array_diff_uassoc( a1, a2, function( k1, k2 ) {
      return ( k1 == k2 ? 0 : ( k1 > k2 ? 1 : -1 ) );
    } );

    deepEqual( diff, { "b": "brown", "c": "blue", 0: "red" } );

  } );

}
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.