Skip to content

Commit

Permalink
dart-lang#2559. Add applying augmentation library tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Mar 8, 2024
1 parent b18dfd0 commit 2bdeed8
Show file tree
Hide file tree
Showing 19 changed files with 377 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import augment 'applying_augmentation_library_A01_t01_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library applying_augmentation_library_A01_t01.dart;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive. Test the case when referenced library is part of the main library
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library applying_augmentation_library_A01_t02;

import augment 'applying_augmentation_library_A01_t02_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

part 'applying_augmentation_library_A01_t02_lib.dart';

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive. Test the case when referenced library is part of the main library
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

part of applying_augmentation_library_A01_t02;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive. Test the case when a main library also imports the referenced one
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import 'applying_augmentation_library_A01_t03_lib.dart';
import augment 'applying_augmentation_library_A01_t03_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// - The library referenced in an `import augment` directive is not an
/// augmentation and does not have a `library augment` directive.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `import augment` directive is not an does not have a `library augment`
/// directive. Test the case when a main library also imports the referenced one
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library applying_augmentation_library_A01_t03;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The library referenced in a `library augment` directive does not have an
/// `import augment` directive pointing back to this augmentation.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `library augment` directive is not an does not have a `import augment`
/// directive
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import 'applying_augmentation_library_A02_t01_lib.dart';

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The library referenced in a `library augment` directive does not have an
/// `import augment` directive pointing back to this augmentation.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `library augment` directive does not have a `import augment` directive
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A02_t01.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The library referenced in a `library augment` directive does not have an
/// `import augment` directive pointing back to this augmentation.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `library augment` directive is not an does not have a `import augment`
/// directive pointing back to this augmentation.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import 'applying_augmentation_library_A02_t02_lib1.dart';
import augment 'applying_augmentation_library_A02_t02_lib2.dart';

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The library referenced in a `library augment` directive does not have an
/// `import augment` directive pointing back to this augmentation.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `library augment` directive is not an does not have a `import augment`
/// directive pointing back to this augmentation.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A02_t02.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

// 'applying_augmentation_library_A02_t02.dart' is pointing back to
// 'applying_augmentation_library_A02_t02_lib2.dart' but not to this library
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The library referenced in a `library augment` directive does not have an
/// `import augment` directive pointing back to this augmentation.
///
/// @description Check that it is a compile-time error if a library referenced
/// in an `library augment` directive is not an does not have a `import augment`
/// directive pointing back to this augmentation.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A02_t02.dart';

// Another augmentation library of 'applying_augmentation_library_A02_t02.dart'
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The same augmentation library is applied more than once.
///
/// @description Check that it is a compile-time error if the same augmentation
/// library is applied more than once.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import augment 'applying_augmentation_library_A03_t01_lib.dart';
import augment 'applying_augmentation_library_A03_t01_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The same augmentation library is applied more than once.
///
/// @description Check that it is a compile-time error if the same augmentation
/// library is applied more than once.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A03_t01.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2024, 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 It is a compile-time error if there is more than one library
/// directive in a single file
///
/// @description Check that it is a compile-time error if there is more than one
/// library directive in a single file
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import augment 'applying_augmentation_library_A03_t02_lib.dart';

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2024, 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 It is a compile-time error if there is more than one library
/// directive in a single file
///
/// @description Check that it is a compile-time error if there is more than one
/// library directive in a single file
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A03_t02.dart';
/**/library;
// ^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The main library and its augmentations do not all have the same language
/// version. There is only one user-visible library at the end, and it should
/// have a consistent version across its entire surface area.
///
/// @description Check that it is a compile-time error if an augmentation
/// library has version lower than main.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import augment 'applying_augmentation_library_A04_t01_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The main library and its augmentations do not all have the same language
/// version. There is only one user-visible library at the end, and it should
/// have a consistent version across its entire surface area.
///
/// @description Check that it is a compile-time error if an augmentation
/// library has version lower than main.
/// @author sgrekhov22@gmail.com
// @dart=3.3

// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A04_t01.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The main library and its augmentations do not all have the same language
/// version. There is only one user-visible library at the end, and it should
/// have a consistent version across its entire surface area.
///
/// @description Check that it is a compile-time error if a main library has
/// version lower than augmentation.
/// @author sgrekhov22@gmail.com
// @dart=3.3

// SharedOptions=--enable-experiment=macros

import augment 'applying_augmentation_library_A04_t02_lib.dart';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2024, 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 It is a compile-time error if:
/// ...
/// - The main library and its augmentations do not all have the same language
/// version. There is only one user-visible library at the end, and it should
/// have a consistent version across its entire surface area.
///
/// @description Check that it is a compile-time error if an augmentation
/// library has version lower than main.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

library augment 'applying_augmentation_library_A04_t02.dart';

0 comments on commit 2bdeed8

Please sign in to comment.