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

Enhanced enums in Flutter don't get covered #505

Closed
alberto-sf opened this issue Aug 12, 2022 · 1 comment
Closed

Enhanced enums in Flutter don't get covered #505

alberto-sf opened this issue Aug 12, 2022 · 1 comment

Comments

@alberto-sf
Copy link

alberto-sf commented Aug 12, 2022

I have this enum in a file:

enum VegaRadioSize {
  small(27, 18),
  large(36, 22);
  final double normalSize;
  final double pressedSize;
  const VegaRadioSize(this.normalSize, this.pressedSize);
}

It is tested in this way:

group('VegaRadioSize test', () {
    test('Smoke', () {
      expect(VegaRadioSize.values.length, equals(2));
    });

    test('Large test', () {
      expect(VegaRadioSize.large.normalSize, equals(36));
      expect(VegaRadioSize.large.pressedSize, equals(VegaSpacings.space4));
    });

    test('Small test', () {
      expect(VegaRadioSize.small.normalSize, equals(27));
      expect(VegaRadioSize.small.pressedSize, equals(VegaSpacings.space3));
    });
  });

When running flutter test --coverage, the following result appears:

Screenshot 2022-08-12 at 19 56 44

Is this expected? How can I fully cover the enum?


This (#493) issue was closed by @liamappelbe but I think the problem isn't yet solved.

Here's my setup:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.5 21G72 darwin-arm, locale
en-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version
32.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

And Dart:

Dart SDK version: 2.17.5 (stable) (Tue Jun 21 11:05:10 2022 +0200) on "macos_arm64"

@liamappelbe
Copy link
Contributor

This is fixed in Dart 2.18, which is releasing soon.

@mosuem mosuem transferred this issue from dart-archive/coverage Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants