Skip to content
Snippets Groups Projects
Commit 0133cb00 authored by Agustin Chiappe Berrini's avatar Agustin Chiappe Berrini
Browse files

Test and refactor of array methods

Changes include:

- e2e tests for array methods.
- Make `run_examples.sh` tell you the difference on fail.
- Unit tests for the `ArrayMethod` struct.
- Small refactor to reduce code duplication.
- Small refactor on `graphemes` to avoid cloning the structure.
parent 0b279389
No related branches found
No related tags found
No related merge requests found
echo @split("onetwoone", "two")
echo @split_at("onetwoone", "3")
echo @graphemes("onetwo", "3")
echo @bytes("onetwo")
echo @chars("onetwo")
one one
one twoone
o n e t w o
111 110 101 116 119 111
o n e t w o
......@@ -32,7 +32,7 @@ function check_return_value {
$PROJECT_DIR/target/debug/ion $1 1> $EXAMPLES_DIR/tmp.out 2> /dev/null
# Compare real and expected output
cmp --silent $EXAMPLES_DIR/tmp.out $EXPECTED_OUTPUT_FILE
diff "$EXAMPLES_DIR"/tmp.out "$EXPECTED_OUTPUT_FILE" > "$EXAMPLES_DIR"/diff_tmp
local RET=$?
# Clean up the mess
......@@ -40,9 +40,12 @@ function check_return_value {
# Write result
if [[ $RET -ne 0 ]]; then
cat "$EXAMPLES_DIR"/diff_tmp
rm "$EXAMPLES_DIR"/diff_tmp
echo -e "Test ${1} ${TAGFAIL}";
return 1;
else
rm "$EXAMPLES_DIR"/diff_tmp
echo -e "Test ${1} ${TAGPASS}";
return 0;
fi
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment