Update tests to have an expression rather than a function as the argument in an assert

Change-Id: Ie95b39400adc0acd0b5f2c58dd26d21bb1b8c081
Reviewed-on: https://dart-review.googlesource.com/32502
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Brian Wilkerson 2018-01-05 09:01:00 -08:00 committed by commit-bot@chromium.org
parent 31cd4e1457
commit c151dffb9f
11 changed files with 10 additions and 80 deletions

View file

@ -59,6 +59,8 @@ from_environment_const_type_undefined_test/12: MissingCompileTimeError
from_environment_const_type_undefined_test/13: MissingCompileTimeError
from_environment_const_type_undefined_test/14: MissingCompileTimeError
from_environment_const_type_undefined_test/16: MissingCompileTimeError
int_modulo_arith_test/modPow: RuntimeError
int_modulo_arith_test/none: RuntimeError
int_parse_radix_bad_handler_test: MissingCompileTimeError
map_test: Crash # crash in front_end.
string_from_environment3_test/01: MissingCompileTimeError
@ -435,8 +437,6 @@ bigint_test: Pass, Timeout # Please triage.
apply3_test: CompileTimeError # Issue 31402 (Invocation arguments)
bool_from_environment2_test/03: MissingCompileTimeError
compare_to2_test: RuntimeError
int_modulo_arith_test/modPow: CompileTimeError # Issue 31402 (Assert statement)
int_modulo_arith_test/none: CompileTimeError # Issue 31402 (Assert statement)
iterable_empty_test: RuntimeError
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
@ -468,8 +468,6 @@ unicode_test: RuntimeError
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
bool_from_environment2_test/03: MissingCompileTimeError
compare_to2_test: RuntimeError
int_modulo_arith_test/modPow: CompileTimeError # Issue 31402 (Assert statement)
int_modulo_arith_test/none: CompileTimeError # Issue 31402 (Assert statement)
iterable_empty_test: RuntimeError
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533

View file

@ -25,7 +25,7 @@ testModPow() {
}
return slowModPow(x, e, m) == expectedResult;
});
}());
var result = x.modPow(e, m);
Expect.equals(expectedResult, result, "$x.modPow($e, $m)");
}

View file

@ -17,7 +17,6 @@ main() {
// Basics.
assert(true, "");
assert(() => true, "");
int x = null;
// Successful asserts won't execute message.

View file

@ -31,16 +31,6 @@ unknown(dynamic a) {
return a ? true : false;
}
testClosure(bool f()) {
int i = 0;
try {
assert(f);
} on AssertionError {
i = 1;
}
return i;
}
testBoolean(bool value) {
int i = 0;
try {
@ -84,13 +74,10 @@ main() {
Expect.equals(1, testBoolean(null));
Expect.equals(1, testDynamic(null));
Expect.equals(1, testDynamic(42));
Expect.equals(1, testClosure(() => true));
Expect.equals(1, testDynamic(() => true));
Expect.equals(1, testClosure(() => false));
Expect.equals(1, testDynamic(() => false));
Expect.equals(1, testDynamic(() => 42));
Expect.equals(1, testDynamic(() => null));
Expect.equals(1, testClosure(() => null));
Expect.equals(1234, testMessage(false, 1234).message);
Expect.equals('hi', testMessage(false, 'hi').message);

View file

@ -786,6 +786,9 @@ regress_30339_test: RuntimeError # Issue 26429
field_override_optimization_test: RuntimeError
field_type_check2_test/01: MissingRuntimeError
[ $compiler == dart2js && $runtime == d8 && $dart2js_with_kernel ]
assertion_test: RuntimeError
[ $compiler == dart2js && $runtime == drt && $checked && !$dart2js_with_kernel ]
regress_30339_test: RuntimeError # Issue 30393

View file

@ -132,7 +132,6 @@ additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTi
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
arithmetic_test: RuntimeError # Issue 31763
assert_message_test: CompileTimeError
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError
@ -144,7 +143,6 @@ assertion_initializer_const_error2_test/cc09: MissingCompileTimeError
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
assertion_test: CompileTimeError
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
@ -685,6 +683,7 @@ void_type_callbacks_test/none: CompileTimeError
wrong_number_type_arguments_test/01: MissingCompileTimeError
[ $compiler == dartdevc && $runtime != none ]
assertion_test: RuntimeError # Issue 30326; Expect.equals(expected: <1>, actual: <0>) fails.
async_star_test/01: RuntimeError
async_star_test/03: RuntimeError
async_star_test/04: RuntimeError
@ -829,7 +828,6 @@ unhandled_exception_negative_test: Fail
# dartdevc and dartdevk, then expectations for dartdevc, and then expectations
# for dartdevk.
[ $runtime != none && ($compiler == dartdevc || $compiler == dartdevk) ]
assertion_test: RuntimeError # Issue 30326; Expect.equals(expected: <1>, actual: <0>) fails.
async_star_cancel_while_paused_test: RuntimeError # Issue 29920; Uncaught Expect.listEquals(list length, expected: <4>, actual: <3>) fails: Next element <*3>
async_star_pause_test: RuntimeError # Uncaught Expect.listEquals(at index 2, expected: <0+>, actual: <0!>) fails
async_star_test/02: RuntimeError

View file

@ -165,9 +165,7 @@ additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTi
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
arithmetic2_test: RuntimeError # Throws CastError instead of TypeError
assert_message_test: CompileTimeError # Issue 31402 (Assert statement)
assertion_initializer_test: CompileTimeError # Issue 31402 (Assert statement)
assertion_test: CompileTimeError # Issue 31402 (Assert statement)
assign_to_type_test/01: MissingCompileTimeError
assign_to_type_test/02: MissingCompileTimeError
assign_to_type_test/03: MissingCompileTimeError
@ -1124,7 +1122,6 @@ unresolved_default_constructor_test/01: MissingCompileTimeError
unresolved_in_factory_test: MissingCompileTimeError
unresolved_top_level_method_test: MissingCompileTimeError
unresolved_top_level_var_test: MissingCompileTimeError
vm/canonicalization_preserves_deopt_test: CompileTimeError # Issue 31402 (Assert statement)
vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM
vm/debug_break_enabled_vm_test/01: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
vm/debug_break_enabled_vm_test/none: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
@ -1366,12 +1363,9 @@ abstract_syntax_test/00: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
assert_message_test: CompileTimeError # Issue 31402 (Assert statement)
assert_with_type_test_or_cast_test: Pass, Crash
assertion_initializer_const_error_test/01: Pass
assertion_initializer_test: CompileTimeError # Issue 31402 (Assert statement)
assertion_test: CompileTimeError # Issue 31402 (Assert statement)
assertion_test: RuntimeError # Issue 30326
assign_to_type_test/01: MissingCompileTimeError
assign_to_type_test/02: MissingCompileTimeError
assign_to_type_test/03: MissingCompileTimeError
@ -2418,7 +2412,6 @@ unresolved_default_constructor_test/01: MissingCompileTimeError
unresolved_in_factory_test: MissingCompileTimeError
unresolved_top_level_method_test: MissingCompileTimeError
unresolved_top_level_var_test: MissingCompileTimeError
vm/canonicalization_preserves_deopt_test: CompileTimeError # Issue 31402 (Assert statement)
vm/causal_async_exception_stack2_test: SkipByDesign
vm/causal_async_exception_stack_test: SkipByDesign
vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM

View file

@ -28,13 +28,13 @@ main() {
assert(() {
Expect.isTrue(bar(-1 << 63));
return true;
});
}());
Expect.isTrue(baz(-1 << 63));
}
Expect.isFalse(foo(new X()));
assert(() {
Expect.isFalse(bar(new X()));
return true;
});
}());
Expect.isFalse(baz(new X()));
}

View file

@ -1,41 +0,0 @@
// Copyright (c) 2011, 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.
// VMOptions=--enable_asserts
// Dart test program testing assert statements.
import "package:expect/expect.dart";
class AssertTest {
static test() {
try {
assert(false);
Expect.fail("Assertion 'false' didn't fail.");
} on AssertionError catch (error) {
Expect.isTrue(error.toString().contains("'false'"));
Expect.isTrue(
error.stackTrace.toString().contains("assert_test.dart:13:14"));
}
}
static testClosure() {
try {
assert(() => false);
Expect.fail("Assertion '() => false' didn't fail.");
} on AssertionError catch (error) {
Expect.isTrue(error.toString().contains("'() => false'"));
Expect.isTrue(
error.stackTrace.toString().contains("assert_test.dart:24:14"));
}
}
static testMain() {
test();
testClosure();
}
}
main() {
AssertTest.testMain();
}

View file

@ -30,9 +30,6 @@ io/socket_info_ipv6_test: SkipByDesign
io/socket_ipv6_test: SkipByDesign
io/socket_source_address_test: SkipByDesign
[ $compiler == app_jit ]
assert_test: RuntimeError
[ $compiler == dart2analyzer ]
deferred_transitive_import_error_test: Skip
@ -92,7 +89,6 @@ io/socket_connect_stream_data_close_cancel_test: Pass, Timeout # Issue 27453
io/socket_many_connections_test: Skip # This test fails with "Too many open files" on the Mac OS buildbot. This is expected as MacOS by default runs with a very low number of allowed open files ('ulimit -n' says something like 256).
[ $strong && ($compiler == dartk || $compiler == dartkp) ]
assert_test: RuntimeError
io/dependency_graph_test: CompileTimeError
io/directory_test: RuntimeError
io/file_error_test: RuntimeError
@ -114,7 +110,6 @@ io/web_socket_protocol_processor_test: RuntimeError
io/zlib_test: RuntimeError
[ !$strong && ($compiler == dartk || $compiler == dartkp) ]
assert_test: RuntimeError
io/compile_all_test: Skip # Crashes
io/http_client_connect_test: Skip # Flaky.
io/http_content_length_test: Skip # Flaky.
@ -142,11 +137,10 @@ regress_29350_test: MissingCompileTimeError
[ $arch == arm || $arch == arm64 || $runtime != vm || $mode == debug && $system == windows ]
fragmentation_test: Skip
[ $compiler == dart2js || $compiler == dartdevc ]
[ $compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk ]
*: SkipByDesign
[ $mode == product || $runtime == dart_precompiled ]
assert_test: SkipByDesign
no_assert_test: SkipByDesign
[ $runtime == dart_precompiled || $runtime == flutter || $runtime == vm ]

View file

@ -21,7 +21,6 @@ io/socket_port_test: Pass, Crash
# ===== dartk + vm status lines =====
[ $compiler == dartk && $runtime == vm && $strong ]
assert_test: CompileTimeError # Issue 31402 (Assert statement)
io/compile_all_test: Crash
io/http_client_request_test: Pass, Timeout
io/http_compression_test: RuntimeError