diff --git a/lib/asciinema/asciicasts.ex b/lib/asciinema/asciicasts.ex index b66e53c..3894ede 100644 --- a/lib/asciinema/asciicasts.ex +++ b/lib/asciinema/asciicasts.ex @@ -106,7 +106,7 @@ defmodule Asciinema.Asciicasts do PosterGenerator.generate(asciicast) end - def stdout_stream(asciicast_file_path) do + def stdout_stream(asciicast_file_path) when is_binary(asciicast_file_path) do asciicast = asciicast_file_path |> File.read! @@ -118,7 +118,7 @@ defmodule Asciinema.Asciicasts do |> Map.get("stdout") |> Enum.map(&List.to_tuple/1) end - def stdout_stream(stdout_timing_path, stdout_data_path) do + def stdout_stream({stdout_timing_path, stdout_data_path}) do Stream.resource( fn -> open_stream_files(stdout_timing_path, stdout_data_path) end, &generate_stream_elem/1, diff --git a/test/asciinema/asciicasts_test.exs b/test/asciinema/asciicasts_test.exs index 88ccf16..6eedbd6 100644 --- a/test/asciinema/asciicasts_test.exs +++ b/test/asciinema/asciicasts_test.exs @@ -119,22 +119,22 @@ defmodule Asciinema.AsciicastsTest do describe "stdout_stream/2" do test "with gzipped files" do - stream = Asciicasts.stdout_stream("spec/fixtures/0.9.9/stdout.time", - "spec/fixtures/0.9.9/stdout") + stream = Asciicasts.stdout_stream({"spec/fixtures/0.9.9/stdout.time", + "spec/fixtures/0.9.9/stdout"}) assert :ok == Stream.run(stream) assert [{1.234567, "foobar"}, {0.123456, "baz"}] == Enum.take(stream, 2) end test "with bzipped files" do - stream = Asciicasts.stdout_stream("spec/fixtures/0.9.8/stdout.time", - "spec/fixtures/0.9.8/stdout") + stream = Asciicasts.stdout_stream({"spec/fixtures/0.9.8/stdout.time", + "spec/fixtures/0.9.8/stdout"}) assert :ok == Stream.run(stream) assert [{1.234567, "foobar"}, {0.123456, "baz"}] == Enum.take(stream, 2) end test "with bzipped files (utf-8 sequence split between frames)" do - stream = Asciicasts.stdout_stream("spec/fixtures/0.9.8/stdout-split.time", - "spec/fixtures/0.9.8/stdout-split") + stream = Asciicasts.stdout_stream({"spec/fixtures/0.9.8/stdout-split.time", + "spec/fixtures/0.9.8/stdout-split"}) assert :ok == Stream.run(stream) assert [{1.234567, "xxżó"}, {0.123456, "łć"}, {2.0, "xx"}] == Enum.take(stream, 3) end