blob: 434c5b953fbf5a4bab2e73a4813ce9cc41a986d8 [file] [log] [blame]
/*
* 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.
*/
/**
* @assertion Throws a FormatException if source is not a valid integer literal.
* @description Check that exception is thrown if String can not be converted to int.
* @author msyabro
* @reviewer pagolubev
*/
import "../../../Utils/expect.dart";
void checkFE(String string) {
try {
int.parse(string);
Expect.fail("FormatException is expected");
} on FormatException catch(e) {}
}
main() {
checkFE("");
checkFE("1.0");
checkFE("1e2");
checkFE("just string");
checkFE("1A");
checkFE("NaN");
checkFE("Infinity");
checkFE("1/1");
checkFE("-");
checkFE("1 2 ");
checkFE("12-");
checkFE("+-1");
}