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

Adds CLI tests for pest2ion #45

Merged
merged 2 commits into from
Jun 11, 2021
Merged

Conversation

almann
Copy link
Contributor

@almann almann commented Jun 11, 2021

Uses assert_cmd and rstest to test the different permutations of the
pest2ion command with real arguments. This includes testing
STDIN/STDOUT defaults as well as file arguments using a temporary
directory per test case. Each format mode is also permuted.

Note that this does not test the "long" argument names, if we care to,
we can always add that for completeness.

The goal here is to make sure the driver works, not to test the completeness
of the pest-ion library crate.

Resolves #42.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

cmd.arg(input_path.to_str().unwrap());
}
};
println!("{:?}", cmd);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to help me visualize the permutations, it is visible if you run cargo with --show-output.

-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-o" "/tmp/.tmpCJA5m0/OUTPUT.ion", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "/tmp/.tmpIZFcxJ/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-o" "/tmp/.tmpGNdUse/OUTPUT.ion" "/tmp/.tmpGNdUse/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-t", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-t" "-o" "/tmp/.tmpPM4bcq/OUTPUT.ion", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-t" "/tmp/.tmp1HNyMC/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-t" "-o" "/tmp/.tmpM8Nz6P/OUTPUT.ion" "/tmp/.tmpM8Nz6P/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-p", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-p" "-o" "/tmp/.tmpKpsoGP/OUTPUT.ion", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-p" "/tmp/.tmphjCwHT/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-p" "-o" "/tmp/.tmpZDh6Up/OUTPUT.ion" "/tmp/.tmpZDh6Up/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-b", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-b" "-o" "/tmp/.tmpXB9Mqf/OUTPUT.ion", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-b" "/tmp/.tmpcYHp3T/INPUT.pest", stdin: None, timeout: None }
-------------- TEST START --------------
Command { cmd: "/home/ANT.AMAZON.COM/almann/CLionProjects/partiql-lang-rust/target/debug/pest2ion" "-b" "-o" "/tmp/.tmpjHh3fL/OUTPUT.ion" "/tmp/.tmpjHh3fL/INPUT.pest", stdin: None, timeout: None }

@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #45 (4e8a2b5) into main (5da7928) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #45   +/-   ##
=======================================
  Coverage   89.54%   89.54%           
=======================================
  Files          10       10           
  Lines         727      727           
=======================================
  Hits          651      651           
  Misses         76       76           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5da7928...4e8a2b5. Read the comment docs.

Copy link

@zslayton zslayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

@almann almann mentioned this pull request Jun 11, 2021
Uses `assert_cmd` and `rstest` to test the different permutations of the
`pest2ion` command with real arguments.  This includes testing
STDIN/STDOUT defaults as well as file arguments using a temporary
directory per test case.  Each format mode is also permuted.

Note that this does not test the "long" argument names, if we care to,
we can always add that for completeness.

Resolves partiql#42.
@almann almann changed the base branch from pest-ion-cli-test-base to main June 11, 2021 17:42
@almann almann merged commit 497bb91 into partiql:main Jun 11, 2021
@almann almann deleted the pest-ion-cli-test branch June 11, 2021 18:04
Copy link

@marcbowes marcbowes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

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.

Test pest2ion CLI Tool
3 participants