That unfortunately gives me the same result.

On Wednesday, April 6, 2022 at 6:57:35 PM UTC+1 Wojtek Mach wrote:

> I believe capture_io(encoding: :latin1, fun) should do the trick, can you 
> check?
>
> On April 6, 2022, "maennchen.ch" <[email protected]> wrote:
>
> Hi everyone,
>
> *Background*
>
> While developing tests for a mix task, that returns non UTF8 binaries into 
> STDOUT (building block to be piped into a file / pipe), I found that 
> ExUnit.CaptureIO can only handle UTF8 and Latin1.
>
> Example Test that does not work:
> https://gist.github.com/maennchen/16d411eeda3255fa3d3152fe9d836a82
>
> *Proposal*
>
> For testing this use case, it would be good if any raw binary would also 
> be passed through. (Maybe via option "encoding: :raw_binary")
>
> Additionally, it would be good if there was a proper error for invalid 
> characters instead of the currently raised ArgumentError.
>
> *Real World Example*
>
> Here is a real test, that would be made possible by this change: 
> https://github.com/elixir-gettext/expo/blob/9048fe242830614f6d4235cbd345de844693f28a/test/mix/tasks/expo.msgfmt_test.exs#L18
>
> *PR*
>
> I'm happy to provide a PR for this as well.
>
> Thanks & Kind Regards,
> Jonatan
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/e35e97cf-00d6-422e-b3c1-ec508ff1e36fn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/e35e97cf-00d6-422e-b3c1-ec508ff1e36fn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/9e817fc9-6f61-4476-bb27-c062ed6167fan%40googlegroups.com.

Reply via email to