Files
sdk/pkg/front_end/testcases/const_functions/const_functions_string.dart.weak.modular.expect
T
Johnni Winther 078d407f40 [cfe] Add modular_suite
This adds a new expectation test suite which mimics the modular
compilation strategy used by dartdevc; the test code is fully compiled
but the linked dependencies are only compiled as outlines.

Change-Id: I4b8a68087997c025eb39aec414ee1706ddf7f847
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222762
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-12-10 14:02:30 +00:00

38 lines
970 B
Plaintext

library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "package:expect/expect.dart" as exp;
import "package:expect/expect.dart";
static const field core::String str = #C1;
static const field core::String var1 = #C2;
static const field dynamic var2 = #C3;
static const field core::String var3 = #C3;
static const field dynamic var4 = #C4;
static method fn() → dynamic {
core::String local = "str";
return local.{core::String::[]}(0){(core::int) → core::String};
}
static method fn2() → dynamic {
try {
core::String x = #C1.{core::String::[]}(1.{core::int::unary-}(){() → core::int}){(core::int) → core::String};
}
on core::RangeError catch(no-exception-var) {
return 2;
}
}
static method main() → void {
exp::Expect::equals(#C2, "r");
exp::Expect::equals(#C3, "s");
exp::Expect::equals(#C3, "s");
exp::Expect::equals(#C4, 2);
}
constants {
#C1 = "str"
#C2 = "r"
#C3 = "s"
#C4 = 2
}