mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:19:48 +00:00
Remove more usages of upper-case constants in SDK
Change-Id: I4e54ed7eba5f2af7852faba2cffae12f28e618cf Reviewed-on: https://dart-review.googlesource.com/51844 Reviewed-by: Erik Ernst <eernst@google.com> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
This commit is contained in:
parent
1f2f8be33a
commit
2eeea7bc30
|
@ -1927,14 +1927,14 @@ TEST_CASE(DartAPI_ExternalByteDataAccess) {
|
|||
" var a = createExternalByteData();"
|
||||
" Expect.equals(length, a.lengthInBytes);"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" Expect.equals(0x4241, a.getInt16(i, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x4241, a.getInt16(i, Endian.little));"
|
||||
" }"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" a.setInt8(i, 0x24);"
|
||||
" a.setInt8(i + 1, 0x28);"
|
||||
" }"
|
||||
" for (int i = 0; i < length; i+=2) {"
|
||||
" Expect.equals(0x2824, a.getInt16(i, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x2824, a.getInt16(i, Endian.little));"
|
||||
" }"
|
||||
" return a;"
|
||||
"}\n";
|
||||
|
@ -1995,10 +1995,10 @@ TEST_CASE(DartAPI_OptimizedExternalByteDataAccess) {
|
|||
"}\n"
|
||||
"ByteData createExternalByteData() native 'CreateExternalByteData';"
|
||||
"access(ByteData a) {"
|
||||
" Expect.equals(0x04030201, a.getUint32(0, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x08070605, a.getUint32(4, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x0c0b0a09, a.getUint32(8, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x100f0e0d, a.getUint32(12, Endianness.LITTLE_ENDIAN));"
|
||||
" Expect.equals(0x04030201, a.getUint32(0, Endian.little));"
|
||||
" Expect.equals(0x08070605, a.getUint32(4, Endian.little));"
|
||||
" Expect.equals(0x0c0b0a09, a.getUint32(8, Endian.little));"
|
||||
" Expect.equals(0x100f0e0d, a.getUint32(12, Endian.little));"
|
||||
"}"
|
||||
"ByteData main() {"
|
||||
" var length = 16;"
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
|
||||
library export1_lib;
|
||||
|
||||
export "dart:math" show LN10, LN2, E;
|
||||
export "dart:math" show ln10, ln2, e;
|
||||
|
||||
var E = "E"; // Hides constant E from math lib.
|
||||
var e = "E"; // Hides constant E from math lib.
|
||||
|
|
|
@ -9,7 +9,7 @@ library importCombinatorsTest;
|
|||
import "package:expect/expect.dart";
|
||||
import "import1_lib.dart" show hide, show hide ugly;
|
||||
import "export1_lib.dart";
|
||||
import "dart:math" as M show E;
|
||||
import "dart:math" as M show e;
|
||||
|
||||
part "import_combinators_part.dart";
|
||||
|
||||
|
@ -19,9 +19,9 @@ main() {
|
|||
// Top-level function from part, refers to imported variable show.
|
||||
Expect.equals("show", lookBehindCurtain());
|
||||
// Top-level variable E from export1_lib.dart.
|
||||
Expect.equals("E", E);
|
||||
Expect.equals("E", e);
|
||||
// Top-level variable E imported from dart:math.
|
||||
Expect.equals(2.718281828459045, M.E);
|
||||
Expect.equals(2.718281828459045, M.e);
|
||||
// Constant LN2 from math library, re-exported by export1_lib.dart.
|
||||
Expect.equals(0.6931471805599453, LN2);
|
||||
Expect.equals(0.6931471805599453, ln2);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ testIsNaN() {
|
|||
}
|
||||
|
||||
testTrigonometric() {
|
||||
Expect.approxEquals(1.0, sin(PI / 2.0), 0.0001);
|
||||
Expect.approxEquals(1.0, sin(pi / 2.0), 0.0001);
|
||||
Expect.approxEquals(1.0, cos(0), 0.0001);
|
||||
Expect.approxEquals(1.0, cos(0.0), 0.0001);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ void testTypeRef() {
|
|||
}
|
||||
|
||||
void testLibPrefix() {
|
||||
var pie = math.PI;
|
||||
var pie = math.pi;
|
||||
final math = 0; // //# 05: compile-time error
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void _testTransform(HtmlEscape escape, String input, String expected) {
|
|||
const _COUNT = 3;
|
||||
|
||||
void main() {
|
||||
_testMode(HTML_ESCAPE, _TEST_INPUT, _OUTPUT_UNKNOWN);
|
||||
_testMode(htmlEscape, _TEST_INPUT, _OUTPUT_UNKNOWN);
|
||||
_testMode(const HtmlEscape(), _TEST_INPUT, _OUTPUT_UNKNOWN);
|
||||
_testMode(
|
||||
const HtmlEscape(HtmlEscapeMode.unknown), _TEST_INPUT, _OUTPUT_UNKNOWN);
|
||||
|
@ -85,5 +85,5 @@ void main() {
|
|||
_OUTPUT_SQ_ATTRIBUTE);
|
||||
_testMode(
|
||||
const HtmlEscape(HtmlEscapeMode.element), _TEST_INPUT, _OUTPUT_ELEMENT);
|
||||
_testMode(HTML_ESCAPE, _NOOP, _NOOP);
|
||||
_testMode(htmlEscape, _NOOP, _NOOP);
|
||||
}
|
||||
|
|
|
@ -153,8 +153,8 @@ test() {
|
|||
|
||||
// Some non-exceptional values.
|
||||
checkVeryClose(16.0, pow(4.0, 2.0));
|
||||
checkVeryClose(SQRT2, pow(2.0, 0.5));
|
||||
checkVeryClose(SQRT1_2, pow(0.5, 0.5));
|
||||
checkVeryClose(sqrt2, pow(2.0, 0.5));
|
||||
checkVeryClose(sqrt1_2, pow(0.5, 0.5));
|
||||
// Denormal result.
|
||||
Expect.identical(5e-324, pow(2.0, -1074.0));
|
||||
// Overflow.
|
||||
|
|
|
@ -14,21 +14,21 @@ class MathLibraryTest {
|
|||
static void testConstants() {
|
||||
// Source for mathematical constants is Wolfram Alpha.
|
||||
Expect.equals(
|
||||
2.7182818284590452353602874713526624977572470936999595749669, math.E);
|
||||
2.7182818284590452353602874713526624977572470936999595749669, math.e);
|
||||
Expect.equals(2.3025850929940456840179914546843642076011014886287729760333,
|
||||
math.LN10);
|
||||
math.ln10);
|
||||
Expect.equals(
|
||||
0.6931471805599453094172321214581765680755001343602552541206, math.LN2);
|
||||
0.6931471805599453094172321214581765680755001343602552541206, math.ln2);
|
||||
Expect.equals(1.4426950408889634073599246810018921374266459541529859341354,
|
||||
math.LOG2E);
|
||||
math.log2e);
|
||||
Expect.equals(0.4342944819032518276511289189166050822943970058036665661144,
|
||||
math.LOG10E);
|
||||
math.log10e);
|
||||
Expect.equals(
|
||||
3.1415926535897932384626433832795028841971693993751058209749, math.PI);
|
||||
3.1415926535897932384626433832795028841971693993751058209749, math.pi);
|
||||
Expect.equals(0.7071067811865475244008443621048490392848359376884740365883,
|
||||
math.SQRT1_2);
|
||||
math.sqrt1_2);
|
||||
Expect.equals(1.4142135623730950488016887242096980785696718753769480731766,
|
||||
math.SQRT2);
|
||||
math.sqrt2);
|
||||
}
|
||||
|
||||
static checkClose(double a, double b, EPSILON) {
|
||||
|
@ -37,65 +37,65 @@ class MathLibraryTest {
|
|||
}
|
||||
|
||||
static void testSin() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.sin(0.0), EPSILON);
|
||||
checkClose(0.0, math.sin(math.PI), EPSILON);
|
||||
checkClose(0.0, math.sin(2.0 * math.PI), EPSILON);
|
||||
checkClose(1.0, math.sin(math.PI / 2.0), EPSILON);
|
||||
checkClose(-1.0, math.sin(math.PI * (3.0 / 2.0)), EPSILON);
|
||||
checkClose(0.0, math.sin(math.pi), EPSILON);
|
||||
checkClose(0.0, math.sin(2.0 * math.pi), EPSILON);
|
||||
checkClose(1.0, math.sin(math.pi / 2.0), EPSILON);
|
||||
checkClose(-1.0, math.sin(math.pi * (3.0 / 2.0)), EPSILON);
|
||||
}
|
||||
|
||||
static void testCos() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(1.0, math.cos(0.0), EPSILON);
|
||||
checkClose(-1.0, math.cos(math.PI), EPSILON);
|
||||
checkClose(1.0, math.cos(2.0 * math.PI), EPSILON);
|
||||
checkClose(0.0, math.cos(math.PI / 2.0), EPSILON);
|
||||
checkClose(0.0, math.cos(math.PI * (3.0 / 2.0)), EPSILON);
|
||||
checkClose(-1.0, math.cos(math.pi), EPSILON);
|
||||
checkClose(1.0, math.cos(2.0 * math.pi), EPSILON);
|
||||
checkClose(0.0, math.cos(math.pi / 2.0), EPSILON);
|
||||
checkClose(0.0, math.cos(math.pi * (3.0 / 2.0)), EPSILON);
|
||||
}
|
||||
|
||||
static void testTan() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.tan(0.0), EPSILON);
|
||||
checkClose(0.0, math.tan(math.PI), EPSILON);
|
||||
checkClose(0.0, math.tan(2.0 * math.PI), EPSILON);
|
||||
checkClose(1.0, math.tan(math.PI / 4.0), EPSILON);
|
||||
checkClose(0.0, math.tan(math.pi), EPSILON);
|
||||
checkClose(0.0, math.tan(2.0 * math.pi), EPSILON);
|
||||
checkClose(1.0, math.tan(math.pi / 4.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAsin() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.asin(0.0), EPSILON);
|
||||
checkClose(math.PI / 2.0, math.asin(1.0), EPSILON);
|
||||
checkClose(-math.PI / 2.0, math.asin(-1.0), EPSILON);
|
||||
checkClose(math.pi / 2.0, math.asin(1.0), EPSILON);
|
||||
checkClose(-math.pi / 2.0, math.asin(-1.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAcos() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.acos(1.0), EPSILON);
|
||||
checkClose(math.PI, math.acos(-1.0), EPSILON);
|
||||
checkClose(math.PI / 2.0, math.acos(0.0), EPSILON);
|
||||
checkClose(math.pi, math.acos(-1.0), EPSILON);
|
||||
checkClose(math.pi / 2.0, math.acos(0.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAtan() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.atan(0.0), EPSILON);
|
||||
checkClose(math.PI / 4.0, math.atan(1.0), EPSILON);
|
||||
checkClose(-math.PI / 4.0, math.atan(-1.0), EPSILON);
|
||||
checkClose(math.pi / 4.0, math.atan(1.0), EPSILON);
|
||||
checkClose(-math.pi / 4.0, math.atan(-1.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAtan2() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, math.atan2(0.0, 5.0), EPSILON);
|
||||
checkClose(math.PI / 4.0, math.atan2(2.0, 2.0), EPSILON);
|
||||
checkClose(3 * math.PI / 4.0, math.atan2(0.5, -0.5), EPSILON);
|
||||
checkClose(-3 * math.PI / 4.0, math.atan2(-2.5, -2.5), EPSILON);
|
||||
checkClose(math.pi / 4.0, math.atan2(2.0, 2.0), EPSILON);
|
||||
checkClose(3 * math.pi / 4.0, math.atan2(0.5, -0.5), EPSILON);
|
||||
checkClose(-3 * math.pi / 4.0, math.atan2(-2.5, -2.5), EPSILON);
|
||||
}
|
||||
|
||||
static checkVeryClose(double a, double b) {
|
||||
|
|
|
@ -11,21 +11,21 @@ class MathTest {
|
|||
static void testConstants() {
|
||||
// Source for mathematical constants is Wolfram Alpha.
|
||||
Expect.equals(
|
||||
2.7182818284590452353602874713526624977572470936999595749669, E);
|
||||
2.7182818284590452353602874713526624977572470936999595749669, e);
|
||||
Expect.equals(
|
||||
2.3025850929940456840179914546843642076011014886287729760333, LN10);
|
||||
2.3025850929940456840179914546843642076011014886287729760333, ln10);
|
||||
Expect.equals(
|
||||
0.6931471805599453094172321214581765680755001343602552541206, LN2);
|
||||
0.6931471805599453094172321214581765680755001343602552541206, ln2);
|
||||
Expect.equals(
|
||||
1.4426950408889634073599246810018921374266459541529859341354, LOG2E);
|
||||
1.4426950408889634073599246810018921374266459541529859341354, log2e);
|
||||
Expect.equals(
|
||||
0.4342944819032518276511289189166050822943970058036665661144, LOG10E);
|
||||
0.4342944819032518276511289189166050822943970058036665661144, log10e);
|
||||
Expect.equals(
|
||||
3.1415926535897932384626433832795028841971693993751058209749, PI);
|
||||
3.1415926535897932384626433832795028841971693993751058209749, pi);
|
||||
Expect.equals(
|
||||
0.7071067811865475244008443621048490392848359376884740365883, SQRT1_2);
|
||||
0.7071067811865475244008443621048490392848359376884740365883, sqrt1_2);
|
||||
Expect.equals(
|
||||
1.4142135623730950488016887242096980785696718753769480731766, SQRT2);
|
||||
1.4142135623730950488016887242096980785696718753769480731766, sqrt2);
|
||||
}
|
||||
|
||||
static checkClose(double a, double b, EPSILON) {
|
||||
|
@ -34,65 +34,65 @@ class MathTest {
|
|||
}
|
||||
|
||||
static void testSin() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, sin(0.0), EPSILON);
|
||||
checkClose(0.0, sin(PI), EPSILON);
|
||||
checkClose(0.0, sin(2.0 * PI), EPSILON);
|
||||
checkClose(1.0, sin(PI / 2.0), EPSILON);
|
||||
checkClose(-1.0, sin(PI * (3.0 / 2.0)), EPSILON);
|
||||
checkClose(0.0, sin(pi), EPSILON);
|
||||
checkClose(0.0, sin(2.0 * pi), EPSILON);
|
||||
checkClose(1.0, sin(pi / 2.0), EPSILON);
|
||||
checkClose(-1.0, sin(pi * (3.0 / 2.0)), EPSILON);
|
||||
}
|
||||
|
||||
static void testCos() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(1.0, cos(0.0), EPSILON);
|
||||
checkClose(-1.0, cos(PI), EPSILON);
|
||||
checkClose(1.0, cos(2.0 * PI), EPSILON);
|
||||
checkClose(0.0, cos(PI / 2.0), EPSILON);
|
||||
checkClose(0.0, cos(PI * (3.0 / 2.0)), EPSILON);
|
||||
checkClose(-1.0, cos(pi), EPSILON);
|
||||
checkClose(1.0, cos(2.0 * pi), EPSILON);
|
||||
checkClose(0.0, cos(pi / 2.0), EPSILON);
|
||||
checkClose(0.0, cos(pi * (3.0 / 2.0)), EPSILON);
|
||||
}
|
||||
|
||||
static void testTan() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, tan(0.0), EPSILON);
|
||||
checkClose(0.0, tan(PI), EPSILON);
|
||||
checkClose(0.0, tan(2.0 * PI), EPSILON);
|
||||
checkClose(1.0, tan(PI / 4.0), EPSILON);
|
||||
checkClose(0.0, tan(pi), EPSILON);
|
||||
checkClose(0.0, tan(2.0 * pi), EPSILON);
|
||||
checkClose(1.0, tan(pi / 4.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAsin() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, asin(0.0), EPSILON);
|
||||
checkClose(PI / 2.0, asin(1.0), EPSILON);
|
||||
checkClose(-PI / 2.0, asin(-1.0), EPSILON);
|
||||
checkClose(pi / 2.0, asin(1.0), EPSILON);
|
||||
checkClose(-pi / 2.0, asin(-1.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAcos() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, acos(1.0), EPSILON);
|
||||
checkClose(PI, acos(-1.0), EPSILON);
|
||||
checkClose(PI / 2.0, acos(0.0), EPSILON);
|
||||
checkClose(pi, acos(-1.0), EPSILON);
|
||||
checkClose(pi / 2.0, acos(0.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAtan() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, atan(0.0), EPSILON);
|
||||
checkClose(PI / 4.0, atan(1.0), EPSILON);
|
||||
checkClose(-PI / 4.0, atan(-1.0), EPSILON);
|
||||
checkClose(pi / 4.0, atan(1.0), EPSILON);
|
||||
checkClose(-pi / 4.0, atan(-1.0), EPSILON);
|
||||
}
|
||||
|
||||
static void testAtan2() {
|
||||
// Given the imprecision of PI we can't expect better results than this.
|
||||
// Given the imprecision of pi we can't expect better results than this.
|
||||
final double EPSILON = 1e-15;
|
||||
checkClose(0.0, atan2(0.0, 5.0), EPSILON);
|
||||
checkClose(PI / 4.0, atan2(2.0, 2.0), EPSILON);
|
||||
checkClose(3 * PI / 4.0, atan2(0.5, -0.5), EPSILON);
|
||||
checkClose(-3 * PI / 4.0, atan2(-2.5, -2.5), EPSILON);
|
||||
checkClose(pi / 4.0, atan2(2.0, 2.0), EPSILON);
|
||||
checkClose(3 * pi / 4.0, atan2(0.5, -0.5), EPSILON);
|
||||
checkClose(-3 * pi / 4.0, atan2(-2.5, -2.5), EPSILON);
|
||||
}
|
||||
|
||||
static checkVeryClose(double a, double b) {
|
||||
|
@ -124,8 +124,8 @@ class MathTest {
|
|||
|
||||
static void testSqrt() {
|
||||
checkVeryClose(2.0, sqrt(4.0));
|
||||
checkVeryClose(SQRT2, sqrt(2.0));
|
||||
checkVeryClose(SQRT1_2, sqrt(0.5));
|
||||
checkVeryClose(sqrt2, sqrt(2.0));
|
||||
checkVeryClose(sqrt1_2, sqrt(0.5));
|
||||
checkVeryClose(1e50, sqrt(1e100));
|
||||
checkVeryClose(1.1111111061110855443054405046358901279277111935183977e56,
|
||||
sqrt(12345678901234e99));
|
||||
|
@ -134,16 +134,16 @@ class MathTest {
|
|||
static void testExp() {
|
||||
checkVeryClose(E, exp(1.0));
|
||||
final EPSILON = 1e-15;
|
||||
checkClose(10.0, exp(LN10), EPSILON);
|
||||
checkClose(2.0, exp(LN2), EPSILON);
|
||||
checkClose(10.0, exp(ln10), EPSILON);
|
||||
checkClose(2.0, exp(ln2), EPSILON);
|
||||
}
|
||||
|
||||
static void testLog() {
|
||||
// Even though E is imprecise, it is good enough to get really close to 1.
|
||||
// We still provide an epsilon.
|
||||
checkClose(1.0, log(E), 1e-16);
|
||||
checkVeryClose(LN10, log(10.0));
|
||||
checkVeryClose(LN2, log(2.0));
|
||||
checkVeryClose(ln10, log(10.0));
|
||||
checkVeryClose(ln2, log(2.0));
|
||||
}
|
||||
|
||||
static bool parseIntThrowsFormatException(str) {
|
||||
|
|
|
@ -48,5 +48,5 @@ void main([args]) {
|
|||
// Mmmmh, Pie!
|
||||
var pie = 4.0 * (inside / (inside + outside));
|
||||
print("$pie");
|
||||
Expect.isTrue(((PI - 0.009) < pie) && (pie < (PI + 0.009)));
|
||||
Expect.isTrue(((pi - 0.009) < pie) && (pie < (pi + 0.009)));
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ void testListenOn() {
|
|||
|
||||
void testHttpServerZone() {
|
||||
asyncStart();
|
||||
Expect.equals(Zone.ROOT, Zone.current);
|
||||
Expect.equals(Zone.root, Zone.current);
|
||||
runZoned(() {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
HttpServer.bind("127.0.0.1", 0).then((server) {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
server.listen((request) {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
request.response.close();
|
||||
server.close();
|
||||
});
|
||||
|
@ -158,15 +158,15 @@ void testHttpServerZone() {
|
|||
|
||||
void testHttpServerZoneError() {
|
||||
asyncStart();
|
||||
Expect.equals(Zone.ROOT, Zone.current);
|
||||
Expect.equals(Zone.root, Zone.current);
|
||||
runZoned(() {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
HttpServer.bind("127.0.0.1", 0).then((server) {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
server.listen((request) {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
request.listen((_) {}, onError: (error) {
|
||||
Expect.notEquals(Zone.ROOT, Zone.current);
|
||||
Expect.notEquals(Zone.root, Zone.current);
|
||||
server.close();
|
||||
throw error;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue