Skip to content

Commit

Permalink
Project cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
buijs-dev committed May 13, 2024
1 parent cfe40b7 commit 6d67973
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/src/common/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ extension on File {
final endIndex = content.indexOf("pluginClass:");

if (startIndex == -1 || endIndex == -1) {
throw KlutterException(
throw const KlutterException(
"Failed to find tag plugin:platforms:android:package in pubspec.yaml",
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/cli/cli_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() {
});

test("Execute task using main execute entrypoint", () async {
final task = TaskName.gradle;
const task = TaskName.gradle;
final context = Context(Directory.systemTemp, {});
final result = await execute(task, context);
expect(result.contains("Received invalid command"), true);
Expand Down
4 changes: 2 additions & 2 deletions test/src/cli/option_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import "package:test/test.dart";

void main() {
test("Verify InputException toString", () {
expect(InputException("splash!").toString(),
expect(const InputException("splash!").toString(),
"InputException with cause: 'splash!'");
});

Expand Down Expand Up @@ -77,7 +77,7 @@ void main() {
});

group("GroupNameOption throws exception if input is not a bool", () {
final option = GroupNameOption();
const option = GroupNameOption();
void testThrowing(String groupName, String message) {
test("$groupName throws $message", () {
expect(
Expand Down
4 changes: 2 additions & 2 deletions test/src/cli/task_project_clean_cache_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ class DirectoryStub implements Directory {

@override
Future<FileSystemEntity> delete({bool recursive = false}) {
throw KlutterException("BOOM!");
throw const KlutterException("BOOM!");
}

@override
void deleteSync({bool recursive = false}) {
throw KlutterException("BOOM!");
throw const KlutterException("BOOM!");
}

@override
Expand Down
6 changes: 3 additions & 3 deletions test/src/cli/task_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ void main() {
expect(
tasks.getTask(TaskName.add).toString(),
"add\n lib (Required) name of the library to add.\n"
" root (Optional) klutter project root directory. Defaults to \'current working directory\'.\n",
" root (Optional) klutter project root directory. Defaults to 'current working directory'.\n",
);

expect(
tasks.getTask(TaskName.init).toString(),
"init\n bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n root (Optional) klutter project root directory. Defaults to \'current working directory\'.\n ios (Optional) ios version. Defaults to \'13.0\'.\n",
"init\n bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n root (Optional) klutter project root directory. Defaults to 'current working directory'.\n ios (Optional) ios version. Defaults to '13.0'.\n",
);
});

Expand Down Expand Up @@ -78,7 +78,7 @@ void main() {
" bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n"
" flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n"
" root (Optional) klutter project root directory. Defaults to 'current working directory'.\n"
" ios (Optional) ios version. Defaults to \'13.0\'.\n"
" ios (Optional) ios version. Defaults to '13.0'.\n"
"\n"
"get\n"
" flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n"
Expand Down
6 changes: 3 additions & 3 deletions test/src/cli/task_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {
final result =
await _InvalidTask().execute(Context(Directory.systemTemp, {}));
expect(result.isOk, false);
expect(result.message, "unsupported value: Instance of \'FakeInput\'");
expect(result.message, "unsupported value: Instance of 'FakeInput'");
});

test("An exception is thrown when unsupported options are present", () async {
Expand All @@ -48,9 +48,9 @@ void main() {
});

test("Verify toTaskOptionOrNull for valid options", () async {
TaskOption.values.forEach((value) {
for (final value in TaskOption.values) {
expect(value.name.toTaskOptionOrNull, value, reason: "roundtrip $value");
});
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/src/common/exception_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import "package:test/test.dart";
void main() {
test("Verify exception toString returns a readable message", () {
expect(
() => throw KlutterException("BOOM!"),
() => throw const KlutterException("BOOM!"),
throwsA(predicate((e) =>
e is KlutterException &&
e.toString() == "KlutterException with cause: 'BOOM!'")));
Expand Down
1 change: 1 addition & 0 deletions test/src/systemtest/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ void main() {
}
});
} catch (e, s) {
// ignore: avoid_print
print(s);
}

Expand Down

0 comments on commit 6d67973

Please sign in to comment.