From ffa2ac5723f228f77fb0f1f168d3814f3ae172b8 Mon Sep 17 00:00:00 2001 From: JLKwong Date: Wed, 14 Apr 2021 14:26:29 -0700 Subject: [PATCH 1/5] upgrade tests/picture.bats with assert_output (fixes #2189) --- tests/picture.bats | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/picture.bats b/tests/picture.bats index 44909a8165..7a3e40eeef 100755 --- a/tests/picture.bats +++ b/tests/picture.bats @@ -2,6 +2,13 @@ load test-helper @test "$clinom picture" { - run "${clicmd}" picture https://treehouses.io/images/OLE_RPi.png - assert_success -} \ No newline at end of file + run "${clicmd}" picture + assert_success && assert_output -p 'Usage: treehouses picture' && assert_output -p 'Views a picture in the terminal.' +} + +@test "$clinom picture foo.png (invalid image)" { + run "${clicmd}" picture HasAnyoneReallyBeenFarEvenasDecidedtoUseEvenGoWanttodoLookMoreLike.png + assert_success && assert_output -p "Can't open file (permission?):" +} + + From f40cfb492c60aca484a3f02937f2c0de96f7de15 Mon Sep 17 00:00:00 2001 From: JLKwong Date: Wed, 14 Apr 2021 14:27:36 -0700 Subject: [PATCH 2/5] remove whitespace --- tests/picture.bats | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/picture.bats b/tests/picture.bats index 7a3e40eeef..901e6e6577 100755 --- a/tests/picture.bats +++ b/tests/picture.bats @@ -10,5 +10,3 @@ load test-helper run "${clicmd}" picture HasAnyoneReallyBeenFarEvenasDecidedtoUseEvenGoWanttodoLookMoreLike.png assert_success && assert_output -p "Can't open file (permission?):" } - - From 43f5f423581ba0edb7dda54d60991caedeb0cbb3 Mon Sep 17 00:00:00 2001 From: JLKwong Date: Wed, 14 Apr 2021 14:29:18 -0700 Subject: [PATCH 3/5] debug --- tests/picture.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/picture.bats b/tests/picture.bats index 901e6e6577..c7b947dff1 100755 --- a/tests/picture.bats +++ b/tests/picture.bats @@ -3,7 +3,7 @@ load test-helper @test "$clinom picture" { run "${clicmd}" picture - assert_success && assert_output -p 'Usage: treehouses picture' && assert_output -p 'Views a picture in the terminal.' + assert_success && assert_output -p 'Usage: ${clicmd} picture' && assert_output -p 'Views a picture in the terminal.' } @test "$clinom picture foo.png (invalid image)" { From c639bdc226d62c77786afcc585a6f160df742328 Mon Sep 17 00:00:00 2001 From: JLKwong Date: Wed, 14 Apr 2021 14:29:47 -0700 Subject: [PATCH 4/5] debug --- tests/picture.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/picture.bats b/tests/picture.bats index c7b947dff1..a7d1f8bc10 100755 --- a/tests/picture.bats +++ b/tests/picture.bats @@ -3,7 +3,7 @@ load test-helper @test "$clinom picture" { run "${clicmd}" picture - assert_success && assert_output -p 'Usage: ${clicmd} picture' && assert_output -p 'Views a picture in the terminal.' + assert_success && assert_output -p 'Usage: $BASENAME picture' && assert_output -p 'Views a picture in the terminal.' } @test "$clinom picture foo.png (invalid image)" { From 5c46c42f9831cb5af2b90a9e2f2c24eaf4588192 Mon Sep 17 00:00:00 2001 From: JLKwong Date: Wed, 14 Apr 2021 14:30:17 -0700 Subject: [PATCH 5/5] debug --- tests/picture.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/picture.bats b/tests/picture.bats index a7d1f8bc10..7dab9536b4 100755 --- a/tests/picture.bats +++ b/tests/picture.bats @@ -3,7 +3,7 @@ load test-helper @test "$clinom picture" { run "${clicmd}" picture - assert_success && assert_output -p 'Usage: $BASENAME picture' && assert_output -p 'Views a picture in the terminal.' + assert_success && assert_output -p 'Usage:' && assert_output -p 'Views a picture in the terminal.' } @test "$clinom picture foo.png (invalid image)" {