blob: 494445cba5192f1a741bf72cda64932f47608395 [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.
// @dart = 2.9
/// @assertion The String class represents character strings. Strings are
/// immutable.
/// @description Checks that invoking various methods of String class doesn't
/// change the original object
/// @author msyabro
import "../../../Utils/expect.dart";
main() {
String s = "Immutable String ";
String str = "Immutable String ";
str.substring(0, 1);
Expect.isTrue(str == s);
str.toLowerCase();
Expect.isTrue(str == s);
str.toUpperCase();
Expect.isTrue(str == s);
str.trim();
Expect.isTrue(str == s);
str.replaceFirst("mm", "m");
Expect.isTrue(str == s);
str.replaceAll("mm", "m");
Expect.isTrue(str == s);
}