Skip to content

Commit

Permalink
[native_assets_cli] Fix toString of objects used in test names (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes authored Jun 27, 2024
1 parent fcc783c commit 739f12c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkgs/native_assets_cli/lib/src/model/native_code_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ final class DynamicLoadingBundledImpl
DynamicLoadingImpl._uriKey: file!.toFilePath(),
}
};

@override
String toString() => _typeValue;
}

final class DynamicLoadingSystemImpl
Expand Down Expand Up @@ -130,6 +133,9 @@ final class DynamicLoadingSystemImpl
}
return uri == other.uri;
}

@override
String toString() => _typeValue;
}

final class LookupInProcessImpl implements DynamicLoadingImpl, LookupInProcess {
Expand All @@ -154,6 +160,9 @@ final class LookupInProcessImpl implements DynamicLoadingImpl, LookupInProcess {
DynamicLoadingImpl._pathTypeKeyV1_0_0: _typeValueV1_0_0,
}
};

@override
String toString() => _typeValue;
}

final class LookupInExecutableImpl
Expand Down Expand Up @@ -199,6 +208,9 @@ final class StaticLinkingImpl implements LinkModeImpl, StaticLinking {
Map<String, Object> toJsonV1_0_0(Uri? file) => {
NativeCodeAssetImpl._linkModeKey: _typeValue,
};

@override
String toString() => _typeValue;
}

final class NativeCodeAssetImpl implements NativeCodeAsset, AssetImpl {
Expand Down
8 changes: 8 additions & 0 deletions pkgs/native_assets_cli/test/api/asset_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ void main() {
assets.toString();
});

test('toString', () {
StaticLinking().toString();
DynamicLoadingBundled().toString();
DynamicLoadingSystem(Uri.file('foo.so')).toString();
LookupInProcess().toString();
LookupInExecutable().toString();
});

test('Errors', () {
expect(
() => NativeCodeAsset(
Expand Down

0 comments on commit 739f12c

Please sign in to comment.