@function deep-equal($expected) { $when: true; $actual: actual(); $contains-list: true; $temp-1: $actual; $temp-2: $expected; @while $contains-list { $contains-list: false; @if length($temp-1) == length($temp-2) { @for $n from 1 through length($temp-1) { $temp-1-item: nth($temp-1, $n); $temp-2-item: nth($temp-2, $n); @if type-of($temp-1-item) == "list" and type-of($temp-2-item) == "list" { @if length($temp-1-item) == length($temp-2-item) { @for $_n from 1 through length($temp-1-item) { $_temp-1-item: nth($temp-1-item, $_n); $_temp-2-item: nth($temp-2-item, $_n); @if type-of($_temp-1-item) == "list" and type-of($_temp-2-item) == "list" { $contains-list: true; } @else if $_temp-1-item != $_temp-2-item { $when: false; } $temp-1: $_temp-1-item; $temp-2: $_temp-2-item; } } @else { $when: false; } } @else if $temp-1-item != $temp-2-item { $when: false; } } } @else { $when: false; } } $throw: error("dep", "The `deep-equal` matcher has been deprecated, please use the `be` matcher for the same functionality"); @return should("deep equal", $expected, $when); }