Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check(...).deepEquals(...) fails to describe a large-ish Map #2441

Open
matanlurey opened this issue Dec 29, 2024 · 0 comments · May be fixed by #2442
Open

check(...).deepEquals(...) fails to describe a large-ish Map #2441

matanlurey opened this issue Dec 29, 2024 · 0 comments · May be fixed by #2442
Labels
package:checks Issues related to pkg:checks type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@matanlurey
Copy link
Contributor

I am not 100% sure of the cause of the failure (yet), but it can be reproduced with the following test case:

test('can be described failing compared to another large map', () {
  const expected = {
    1: -5,
    2: -4,
    3: -4,
    4: -3,
    5: -3,
    6: -2,
    7: -2,
    8: -1,
    9: -1,
    10: 0,
    11: 0,
    12: 1,
    13: 1,
    14: 2,
    15: 2,
    16: 3,
    17: 3,
    18: 4,
    19: 4,
    20: 5,
    21: 5,
    22: 6,
    23: 6,
    24: 7,
    25: 7,
    26: 8,
    27: 8,
    28: 9,
    29: 9,
    30: 10,
  };
  final actual = {
    1: -4,
    2: -4,
    3: -3,
    4: -3,
    5: -2,
    6: -2,
    7: -1,
    8: -1,
    9: 0,
    10: 0,
    11: 0,
    12: 1,
    13: 1,
    14: 2,
    15: 2,
    16: 3,
    17: 3,
    18: 4,
    19: 4,
    20: 5,
    21: 5,
    22: 6,
    23: 6,
    24: 7,
    25: 7,
    26: 8,
    27: 8,
    28: 9,
    29: 9,
    30: 10
  };
  check(actual).not((a) => a.deepEquals(expected));
});

The failure will look like this:

type 'List<Iterable<String>>' is not a subtype of type 'Iterable<List<String>>' of 'newContents'
dart:collection                                ListBase.replaceRange
package:checks/src/describe.dart 75:14         _prettyPrintCollection
package:checks/src/describe.dart 54:12         _prettyPrint
package:checks/src/describe.dart 17:45         literal
package:checks/src/checks.dart 1006:27         Rejection._fillActual
package:checks/src/checks.dart 706:53          _TestContext.expect.<fn>
package:checks/src/checks.dart 594:65          _Present.apply
package:checks/src/checks.dart 706:16          _TestContext.expect
package:checks/src/extensions/map.dart 103:12  MapChecks.deepEquals
test/extensions/map_test.dart 97:32            main.<fn>.<fn>
package:checks/src/checks.dart 117:12          softCheck
package:checks/src/extensions/core.dart 53:13  CoreChecks.not.<fn>
package:checks/src/checks.dart 706:43          _TestContext.expect.<fn>
package:checks/src/checks.dart 594:65          _Present.apply
package:checks/src/checks.dart 706:16          _TestContext.expect
package:checks/src/extensions/core.dart 50:13  CoreChecks.not
test/extensions/map_test.dart 97:19            main.<fn>

If I can fix the problem, I'll suggest a patch.

@matanlurey matanlurey added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) package:checks Issues related to pkg:checks labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:checks Issues related to pkg:checks type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant