b04c5a433e
Bug:https://github.com/dart-lang/sdk/issues/53161 Change-Id: I3f13af3cb852b3656341922b9656ec91fc413eed Tested: documentation + unit test only CoreLibraryReviewExempt: Only adds documentation and adds a unit test to verify existing behavior Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323426 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Brian Quinlan <bquinlan@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
40 lines
970 B
Dart
40 lines
970 B
Dart
// Copyright (c) 2023, 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.
|
|
|
|
/// This is a companion script to print_test.dart.
|
|
|
|
import 'dart:io';
|
|
|
|
class ToString {
|
|
String _toString;
|
|
|
|
ToString(this._toString);
|
|
|
|
String toString() => _toString;
|
|
}
|
|
|
|
main(List<String> arguments) {
|
|
switch (arguments.last) {
|
|
case "simple-string":
|
|
print("Hello World");
|
|
break;
|
|
case "string-internal-linefeeds":
|
|
print("l1\nl2\nl3");
|
|
break;
|
|
case "string-internal-carriagereturns":
|
|
print("l1\rl2\rl3\r");
|
|
break;
|
|
case "string-internal-carriagereturn-linefeeds":
|
|
print("l1\r\nl2\r\nl3\r\n");
|
|
break;
|
|
case "object-internal-linefeeds":
|
|
print(ToString("l1\nl2\nl3"));
|
|
break;
|
|
default:
|
|
stderr.writeln("Command was not recognized");
|
|
exit(1);
|
|
break;
|
|
}
|
|
}
|