Skip to content

Commit 739f12c

Browse files
authored
[native_assets_cli] Fix toString of objects used in test names (#1241)
1 parent fcc783c commit 739f12c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

pkgs/native_assets_cli/lib/src/model/native_code_asset.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ final class DynamicLoadingBundledImpl
9393
DynamicLoadingImpl._uriKey: file!.toFilePath(),
9494
}
9595
};
96+
97+
@override
98+
String toString() => _typeValue;
9699
}
97100

98101
final class DynamicLoadingSystemImpl
@@ -130,6 +133,9 @@ final class DynamicLoadingSystemImpl
130133
}
131134
return uri == other.uri;
132135
}
136+
137+
@override
138+
String toString() => _typeValue;
133139
}
134140

135141
final class LookupInProcessImpl implements DynamicLoadingImpl, LookupInProcess {
@@ -154,6 +160,9 @@ final class LookupInProcessImpl implements DynamicLoadingImpl, LookupInProcess {
154160
DynamicLoadingImpl._pathTypeKeyV1_0_0: _typeValueV1_0_0,
155161
}
156162
};
163+
164+
@override
165+
String toString() => _typeValue;
157166
}
158167

159168
final class LookupInExecutableImpl
@@ -199,6 +208,9 @@ final class StaticLinkingImpl implements LinkModeImpl, StaticLinking {
199208
Map<String, Object> toJsonV1_0_0(Uri? file) => {
200209
NativeCodeAssetImpl._linkModeKey: _typeValue,
201210
};
211+
212+
@override
213+
String toString() => _typeValue;
202214
}
203215

204216
final class NativeCodeAssetImpl implements NativeCodeAsset, AssetImpl {

pkgs/native_assets_cli/test/api/asset_test.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ void main() {
6262
assets.toString();
6363
});
6464

65+
test('toString', () {
66+
StaticLinking().toString();
67+
DynamicLoadingBundled().toString();
68+
DynamicLoadingSystem(Uri.file('foo.so')).toString();
69+
LookupInProcess().toString();
70+
LookupInExecutable().toString();
71+
});
72+
6573
test('Errors', () {
6674
expect(
6775
() => NativeCodeAsset(

0 commit comments

Comments
 (0)