Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address nits
  • Loading branch information
knopp committed May 27, 2022
commit 3ce88d2c0eedf84f20b3b78702ad27a9e134b42b
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:win32/win32.dart';

import 'folders.dart';

/// Constant for en-US language used in VersionInfo keys
/// Constant for en-US language used in VersionInfo keys.
@visibleForTesting
const String languageEn = '0409';

Expand Down Expand Up @@ -43,6 +43,8 @@ class VersionInfoQuerier {
required String language,
required String encoding,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally, if you wanted to be really paranoid, assert(language.isNotEmpty) and same for encoding at the top of the method.

}) {
assert(language.isNotEmpty);
assert(encoding.isNotEmpty);
if (versionInfo == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import 'package:path_provider_windows/src/path_provider_windows_real.dart'

// A fake VersionInfoQuerier that just returns preset responses.
class FakeVersionInfoQuerier implements VersionInfoQuerier {
FakeVersionInfoQuerier(this.responses,
[this.language = languageEn, this.encoding = encodingUnicode]);
FakeVersionInfoQuerier(
this.responses, {
this.language = languageEn,
this.encoding = encodingUnicode,
});

final String language;
final String encoding;
Expand Down Expand Up @@ -60,7 +63,7 @@ void main() {
pathProvider.versionInfoQuerier = FakeVersionInfoQuerier(<String, String>{
'CompanyName': 'A Company',
'ProductName': 'Amazing App',
}, languageEn, encodingCP1252);
}, language: languageEn, encoding: encodingCP1252);
final String? path = await pathProvider.getApplicationSupportPath();
expect(path, isNotNull);
if (path != null) {
Expand All @@ -74,7 +77,7 @@ void main() {
pathProvider.versionInfoQuerier = FakeVersionInfoQuerier(<String, String>{
'CompanyName': 'A Company',
'ProductName': 'Amazing App',
}, languageEn, encodingUnicode);
}, language: languageEn, encoding: encodingUnicode);
final String? path = await pathProvider.getApplicationSupportPath();
expect(path, isNotNull);
if (path != null) {
Expand All @@ -90,7 +93,7 @@ void main() {
pathProvider.versionInfoQuerier = FakeVersionInfoQuerier(<String, String>{
'CompanyName': 'A Company',
'ProductName': 'Amazing App',
}, '0000', '0000');
}, language: '0000', encoding: '0000');
final String? path = await pathProvider.getApplicationSupportPath();
expect(path, contains(r'C:\'));
expect(path, contains(r'AppData'));
Expand Down