Skip to content

Commit

Permalink
fix: Prefer delegation implementation to allow comparator extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdelaziz GACEMI committed May 24, 2023
1 parent 0c0e06d commit 395a760
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions bricks/test_optimizer/__brick__/test/.test_optimizer.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/commands/test/templates/test_optimizer_bundle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final testOptimizerBundle = MasonBundle.fromJson(<String, dynamic>{
{
"path": "test/.test_optimizer.dart",
"data":
"Ly8gR0VORVJBVEVEIENPREUgLSBETyBOT1QgTU9ESUZZIEJZIEhBTkQKLy8gQ29uc2lkZXIgYWRkaW5nIHRoaXMgZmlsZSB0byB5b3VyIC5naXRpZ25vcmUuCgp7eyNpc0ZsdXR0ZXJ9fWltcG9ydCAnZGFydDppbyc7CgppbXBvcnQgJ3BhY2thZ2U6Zmx1dHRlcl90ZXN0L2ZsdXR0ZXJfdGVzdC5kYXJ0JzsKe3svaXNGbHV0dGVyfX17e15pc0ZsdXR0ZXJ9fWltcG9ydCAncGFja2FnZTp0ZXN0L3Rlc3QuZGFydCc7e3svaXNGbHV0dGVyfX0KCnt7I3Rlc3RzfX1pbXBvcnQgJ3t7e3BhdGh9fX0nIGFzIHt7aWRlbnRpZmllcn19Owp7ey90ZXN0c319CnZvaWQgbWFpbigpIHsKe3sjaXNGbHV0dGVyfX0gIGdvbGRlbkZpbGVDb21wYXJhdG9yID0gX1Rlc3RPcHRpbWl6YXRpb25Bd2FyZUdvbGRlbkZpbGVDb21wYXJhdG9yKCk7e3svaXNGbHV0dGVyfX0Ke3sjdGVzdHN9fSAgZ3JvdXAoJ3t7e3BhdGh9fX0nLCAoKSB7IHt7aWRlbnRpZmllcn19Lm1haW4oKTsgfSk7Cnt7L3Rlc3RzfX19Cgp7eyNpc0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gICByZXR1cm4gVXJpLnBhcnNlKGdvbGRlbkZpbGVQYXRocwogICAgICAgIC5zaW5nbGVXaGVyZSgoZ29sZGVuRmlsZVBhdGgpID0+IGdvbGRlbkZpbGVQYXRoLmVuZHNXaXRoKGtleVN0cmluZykpKTsKICB9CgogIEBvdmVycmlkZQogIEZ1dHVyZTx2b2lkPiB1cGRhdGUoVXJpIGdvbGRlbiwgVWludDhMaXN0IGltYWdlQnl0ZXMpID0+IHByZXZpb3VzR29sZGVuRmlsZUNvbXBhcmF0b3IudXBkYXRlKGdvbGRlbiwgaW1hZ2VCeXRlcyk7Cgp9Cnt7L2lzRmx1dHRlcn19",
"type": "text"
}
],
Expand Down

0 comments on commit 395a760

Please sign in to comment.