2016-06-07 21:02:11 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
set -e
|
2016-07-05 16:20:10 +02:00
|
|
|
set -x
|
2016-06-07 21:02:11 +02:00
|
|
|
|
2016-07-11 20:20:51 +02:00
|
|
|
export ASCIINEMA_CONFIG_HOME=`mktemp -d 2>/dev/null || mktemp -d -t asciinema-config-home`
|
2016-07-12 12:16:07 +02:00
|
|
|
TMP_DATA_DIR=`mktemp -d 2>/dev/null || mktemp -d -t asciinema-data-dir`
|
2017-11-18 16:22:24 +01:00
|
|
|
trap "rm -rf $ASCIINEMA_CONFIG_HOME $TMP_DATA_DIR" EXIT
|
2016-07-11 20:20:51 +02:00
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
function asciinema() {
|
|
|
|
|
python3 -m asciinema "$@"
|
|
|
|
|
}
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2017-10-27 10:38:04 +02:00
|
|
|
# test help message
|
|
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
asciinema -h
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2017-10-27 10:38:04 +02:00
|
|
|
# test version command
|
|
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
asciinema --version
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2017-10-27 10:38:04 +02:00
|
|
|
# test auth command
|
|
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
asciinema auth
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2017-10-27 10:38:04 +02:00
|
|
|
# test play command
|
|
|
|
|
|
|
|
|
|
# asciicast v1
|
|
|
|
|
asciinema play -s 5 tests/demo.json
|
|
|
|
|
asciinema play -s 5 -i 0.2 tests/demo.json
|
2017-11-12 12:58:35 +01:00
|
|
|
cat tests/demo.json | asciinema play -s 5 -
|
2017-10-27 10:38:04 +02:00
|
|
|
|
|
|
|
|
# asciicast v2
|
|
|
|
|
asciinema play -s 5 tests/demo.cast
|
|
|
|
|
asciinema play -s 5 -i 0.2 tests/demo.cast
|
2017-11-12 12:58:35 +01:00
|
|
|
cat tests/demo.cast | asciinema play -s 5 -
|
2017-03-25 13:25:18 +01:00
|
|
|
|
2017-10-27 10:38:04 +02:00
|
|
|
# test rec command
|
2017-04-11 17:26:03 +02:00
|
|
|
|
2017-10-04 20:06:23 +02:00
|
|
|
asciinema rec -c who "$TMP_DATA_DIR/1.cast"
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
bash -c "sleep 1; pkill -28 -n -f 'm asciinema'" &
|
2017-10-04 20:06:23 +02:00
|
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/2.cast"
|
2016-07-05 16:52:08 +02:00
|
|
|
|
2016-07-11 20:33:56 +02:00
|
|
|
bash -c "sleep 1; pkill -n -f 'bash -c echo t3st'" &
|
2017-10-04 20:06:23 +02:00
|
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/3.cast"
|
2016-07-11 20:33:56 +02:00
|
|
|
|
|
|
|
|
bash -c "sleep 1; pkill -9 -n -f 'bash -c echo t3st'" &
|
2017-10-04 20:06:23 +02:00
|
|
|
asciinema rec -c 'bash -c "echo t3st; sleep 2; echo ok"' "$TMP_DATA_DIR/4.cast"
|
2017-09-22 22:21:35 +02:00
|
|
|
|
2017-10-26 17:02:24 +02:00
|
|
|
asciinema rec --stdin -c 'bash -c "echo t3st; sleep 1; echo ok"' "$TMP_DATA_DIR/5.cast"
|
2017-11-18 16:21:35 +01:00
|
|
|
|
|
|
|
|
asciinema rec --raw -c 'bash -c "echo t3st; sleep 1; echo ok"' "$TMP_DATA_DIR/6.raw"
|