moko-resources
moko-resources copied to clipboard
ResourceFormatted cause unit tests failure
Let's say we have a method (lets call it "A") that calls the StringDesc.ResourceFormatted(stringRes, *args) method inside.
If I write a unit test for this method ("A") it is passing with success when running it from Android Studio but it fails when I run it from terminal.
If I change the call to StringDesc.Resource(stringRes) it succeeds everywhere.
I am referring to common unit test.
Example method that fails:
fun getKmmString(stringRes: StringResource, vararg args: Any): StringDesc {
return StringDesc.ResourceFormatted(stringRes, *args)
}
Example method that succeeds:
fun getKmmString(stringRes: StringResource, vararg args: Any): StringDesc {
return StringDesc.Resource(stringRes)
}
@Alex009 hi there, in order to help, I have noticed that the difference between the StringDesc.Resource (that works fine) and the StringDesc.ResourceFormatted is that it's root class is Parcelize and implements Parcelable. I am not sure if this is the root cause though.
@ptsiogas good point. i think it make sense. maybe we should extract parcelable logic in separated holder. it's not widely used feature as i think
I would like to have ResourceFormattedStringDesc available for @Parcelize. Currently it inherits only from StringDesc and not Parcelable. There is a diference ResourceStringDesc that inherits from Parcelable and is ready for @Parcelize
We are using this to pass ResourceFormattedStringDesc between navigation destinations and it requires us to make a workaround. Just leaving this here. :) Let me know if I should create another issue, or not. Thanks