blob: 117317136fa082cde76b587fbd973cc51c8f9dd3 [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../compiler_helper.dart';
const String TEST_ONE = r"""
sum(param0, param1) {
var sum = 0;
for (var i = param0; i < param1; i += 1) sum = sum + i;
return sum;
}
""";
main() {
runTest({bool useKernel}) async {
await compile(TEST_ONE, entry: 'sum', useKernel: useKernel,
check: (String generated) {
RegExp regexp = new RegExp(getNumberTypeCheck('(param1|b)'));
Expect.isTrue(regexp.hasMatch(generated));
});
}
asyncTest(() async {
print('--test from ast---------------------------------------------------');
await runTest(useKernel: false);
print('--test from kernel------------------------------------------------');
await runTest(useKernel: true);
});
}