Skip to content

Commit

Permalink
[cfe] Add test to verify legacy main method requirements
Browse files Browse the repository at this point in the history
Change-Id: I3173d85ffe1d92840458fb28fcf2073bec3899ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166241
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
  • Loading branch information
johnniwinther authored and commit-bot@chromium.org committed Oct 7, 2020
1 parent f122752 commit a49217b
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/front_end/testcases/general/main_declaration.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) 2020, 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.

import 'main_declaration_lib.dart';

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
library;
import self as self;

import "org-dartlang-testcase:///main_declaration_lib.dart";

static method main() → dynamic
;

library;
import self as self2;
import "dart:core" as core;

static method main(core::String* args) → dynamic
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
library;
import self as self;

import "org-dartlang-testcase:///main_declaration_lib.dart";

static method main() → dynamic {}

library;
import self as self2;
import "dart:core" as core;

static method main(core::String* args) → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
library;
import self as self;

import "org-dartlang-testcase:///main_declaration_lib.dart";

static method main() → dynamic {}

library;
import self as self2;
import "dart:core" as core;

static method main(core::String* args) → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'main_declaration_lib.dart';

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'main_declaration_lib.dart';

main() {}
6 changes: 6 additions & 0 deletions pkg/front_end/testcases/general/main_declaration_lib.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2020, 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 would be an invalid main declaration in a null safe library.
main(String args) {}
9 changes: 9 additions & 0 deletions pkg/front_end/testcases/nnbd_mixed/main_declaration.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2020, 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.8

import 'main_declaration_lib.dart';

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @dart = 2.8
import 'main_declaration_lib.dart';

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @dart = 2.8
import 'main_declaration_lib.dart';

main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
library;
import self as self;

import "org-dartlang-testcase:///main_declaration_lib.dart";

static method main() → dynamic {}

library;
import self as self2;
import "dart:core" as core;

static method main(core::String* args) → dynamic {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
library;
import self as self;

import "org-dartlang-testcase:///main_declaration_lib.dart";

static method main() → dynamic {}

library;
import self as self2;
import "dart:core" as core;

static method main(core::String* args) → dynamic {}
8 changes: 8 additions & 0 deletions pkg/front_end/testcases/nnbd_mixed/main_declaration_lib.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2020, 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.8

// This would be an invalid main declaration in a null safe library.
main(String args) {}

0 comments on commit a49217b

Please sign in to comment.