Skip to content

Brittle test co19/LanguageFeatures/Extension-methods/call_member_t02.dart #484

@nshahan

Description

@nshahan

This unit test for extension methods relies on the string representation of numbers which varies slightly on our web platforms where we fall back to how the numbers are represented in javascript.

Expect.equals("My name is int(10)", 1(10));
Expect.equals("My name is int(10.0)", 1(10.0));
Expect.equals("My name is num(10)", 1.0(10));
Expect.equals("My name is num(10.0)", 1.0(10.0));

In this case floating point numbers that represent integral values are printed without a decimal and are causing the test to fail even though the extension method feature is working. Could the test be rewritten to avoid this?

On the DartVM:

num n = 10.0;
print(n); // prints 10.0

On web platforms:

num n = 10.0;
print(n); // prints 10

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions