From 8a069645ae2c4f1ac2577c7bf8c4851255f08102 Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Wed, 30 Aug 2023 15:36:57 +0300 Subject: [PATCH] #2242. Add line endings tests (#2250) --- .gitattributes | 3 +++ .../Lexical_Rules/line_endings_cr_t01.dart | 1 + .../Lexical_Rules/line_endings_crlf_t01.dart | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 .gitattributes create mode 100644 Language/Reference/Lexical_Rules/line_endings_cr_t01.dart create mode 100644 Language/Reference/Lexical_Rules/line_endings_crlf_t01.dart diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..2064359c2e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Tests below shouldn't be part end-of-line conversion upon checkin or checkout +Language/Reference/Lexical_Rules/line_endings_cr_t01.dart -text +Language/Reference/Lexical_Rules/line_endings_crlf_t01.dart text eol=crlf diff --git a/Language/Reference/Lexical_Rules/line_endings_cr_t01.dart b/Language/Reference/Lexical_Rules/line_endings_cr_t01.dart new file mode 100644 index 0000000000..6e7c17c43e --- /dev/null +++ b/Language/Reference/Lexical_Rules/line_endings_cr_t01.dart @@ -0,0 +1 @@ +// 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. /// @assertion Dart source text is represented as a sequence of Unicode code /// points. /// /// @description Checks that Dart program may use CR line endings /// @author sgrekhov22@gmail.com String hello() => "Hello"; class World { String world() { return "World!"; } } main() { print(hello() + " " + World().world()); } \ No newline at end of file diff --git a/Language/Reference/Lexical_Rules/line_endings_crlf_t01.dart b/Language/Reference/Lexical_Rules/line_endings_crlf_t01.dart new file mode 100644 index 0000000000..73ab92162f --- /dev/null +++ b/Language/Reference/Lexical_Rules/line_endings_crlf_t01.dart @@ -0,0 +1,21 @@ +// 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. + +/// @assertion Dart source text is represented as a sequence of Unicode code +/// points. +/// +/// @description Checks that Dart program may use CRLF line endings +/// @author sgrekhov22@gmail.com + +String hello() => "Hello"; + +class World { + String world() { + return "World!"; + } +} + +main() { + print(hello() + " " + World().world()); +}