Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validates cast before applying transformation #12

Merged
merged 2 commits into from
Jul 10, 2018
Merged

Validates cast before applying transformation #12

merged 2 commits into from
Jul 10, 2018

Conversation

cirocosta
Copy link
Owner

@cirocosta cirocosta commented Jul 10, 2018

commit 9c7070106010c7335b2090fda67bd133a04351e9

    Adds input cast validation to `transformer`
    
    Whenever a cast is consumed from `transformer`, a cast validation is now
    performed.
    
    This commit makes even more natural to develop the commands as the developer
    doesn't need to worry about receiving invalid casts.
    
    Naturally, that's the expectation - there might exist a case when a
    a command could potentially *want* to receive an invalid cast (which is
    not the situation right now).

Example

diff --git a/fixture/test.cast b/fixture/test.cast
index 450cd5b..35d9622 100644
--- a/fixture/test.cast
+++ b/fixture/test.cast
@@ -6,6 +6,7 @@
 [0.71805, "o", "\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m \u001b[36masciinema-edit \u001b[01;34m(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m\u001b[00m\u001b[01;34m \u001b[00m\u001b[K"]
 [0.71837, "o", "\u001b[?1h\u001b=\u001b[?2004h"]
 [2.180143, "o", "h"]
+[3.491024, "o", "a"]
 [2.251254, "o", "\bhe"]
 [2.323189, "o", "y"]
 [2.578577, "o", "\u001b[?1l\u001b>"]
@@ -27,7 +28,6 @@
 [3.195158, "o", "i"]
 [3.307171, "o", "s"]
 [3.37903, "o", " "]
-[3.491024, "o", "a"]
 [3.578843, "o", " "]
 [4.194759, "o", "\b"]
 [4.328254, "o", "\b \b"]
./asciinema-edit speed --factor=1 ./fixture/test.cast 
invalid input cast: invalid event stream: events must be ordered by time

(before it wouldn't produce an early fail)

#11

Ciro S. Costa added 2 commits July 10, 2018 18:07
Whenever a cast is consumed from `transformer`, a cast validation is now
performed.

This commit makes even more natural to develop the commands as the developer
doesn't need to worry about receiving invalid casts.

Naturally, that's the expectation - there might exist a case when a
a command could potentially *want* to receive an invalid cast (which is
not the situation right now).
@cirocosta
Copy link
Owner Author

cc @henvic

@cirocosta cirocosta merged commit 28a7d76 into master Jul 10, 2018
@cirocosta cirocosta deleted the cast-ooo branch July 10, 2018 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant