From dabe0a2ef57682f1eae5e27c60cbf68a366fc54a Mon Sep 17 00:00:00 2001 From: servostar Date: Tue, 27 Aug 2024 20:54:33 +0200 Subject: [PATCH] fixed failing tests --- run-ci.sh | 23 ++++++++---- tests/invalid-config/test-case-1.typ | 3 +- tests/invalid-config/test-case-2.typ | 56 ++++++++++++++-------------- tests/invalid-config/test-case-3.typ | 44 +++++++++++----------- tests/local-import/main.typ | 6 +-- 5 files changed, 71 insertions(+), 61 deletions(-) diff --git a/run-ci.sh b/run-ci.sh index f20cbae..02934d7 100755 --- a/run-ci.sh +++ b/run-ci.sh @@ -26,8 +26,17 @@ function enter-section() { eval "$2" exit_status=$? - if ! [ $exit_status -eq $3 ]; then - abort "command: $2 failed in section: $1" + + if [ "$3" == "should fail" ]; then + log "INFO" "expected to fail..." + if [ $exit_status -eq 0 ]; then + abort "command: $2 failed in section: $1 with: $exit_status" + fi + else + log "INFO" "expected to pass..." + if [ ! $exit_status -eq 0 ]; then + abort "command: $2 failed in section: $1 with: $exit_status" + fi fi printf "\\n" @@ -36,10 +45,10 @@ function enter-section() { enter-section "Typstyle checking" "./run-fmt.sh --check src/lib.typ" 0 enter-section "BUILD: ABB code theme" "./generate-theme.sh" 0 -enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" 0 -enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." 0 -enter-section "TEST: invalid config case 1" "typst compile tests/invalid-config/test-case-1.typ --root ." 1 -enter-section "TEST: invalid config case 2" "compile tests/invalid-config/test-case-2.typ" 0 -enter-section "TEST: invalid config case 3" "typst compile tests/invalid-config/test-case-3.typ --root ." 1 +enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" +enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." +enter-section "TEST: invalid config case 1" "typst compile tests/invalid-config/test-case-1.typ --root ." "should fail" +enter-section "TEST: invalid config case 2" "typst compile tests/invalid-config/test-case-2.typ --root ." +enter-section "TEST: invalid config case 3" "typst compile tests/invalid-config/test-case-3.typ --root ." "should fail" log "INFO" "CI completed successfully" diff --git a/tests/invalid-config/test-case-1.typ b/tests/invalid-config/test-case-1.typ index 92d7098..5059966 100644 --- a/tests/invalid-config/test-case-1.typ +++ b/tests/invalid-config/test-case-1.typ @@ -1,8 +1,7 @@ #import "../../src/lib.typ": dhbw-template -#show: dhbw-template.with( - config: ( +#show: dhbw-template.with(( lang: none, region: "en", author: ( diff --git a/tests/invalid-config/test-case-2.typ b/tests/invalid-config/test-case-2.typ index 10793ca..d3ec335 100644 --- a/tests/invalid-config/test-case-2.typ +++ b/tests/invalid-config/test-case-2.typ @@ -1,30 +1,32 @@ #import "../../src/lib.typ": dhbw-template -#show: dhbw-template.with( - config: ( - lang: "en", - this-key-is-not-in-config: "Ha Ha", - region: "en", - author: ( - name: "Sven Vogel", - semester: 4, - program: "Informationtechnology", - course: "TINF19IT1", - faculty: "Technik", - university: "DHBW Mannheim", - company: "ABB AG", - supervisor: "Benny Goodman", - matriculation-number: 123456789), - thesis: ( - title: "Unofficial ABB/DHBW Typst template", - subtitle: "for reports and thesises", - submission-date: "23rd march 2020", - timeframe: "1st january 2020 - 20th march 2020", - kind: "T2000", - summary: none, - abstract: none, - keywords: ( "IT", "other stuff" ), - bibliography: none, - glossary: none, - appendices: none))) +#show: dhbw-template.with(( + lang: "en", + this-key-is-not-in-config: "Ha Ha", + region: "en", + author: ( + name: "Sven Vogel", + semester: 4, + program: "Informationtechnology", + course: "TINF19IT1", + faculty: "Technik", + university: "DHBW Mannheim", + company: "ABB AG", + supervisor: "Benny Goodman", + matriculation-number: 123456789, + ), + thesis: ( + title: "Unofficial ABB/DHBW Typst template", + subtitle: "for reports and thesises", + submission-date: "23rd march 2020", + timeframe: "1st january 2020 - 20th march 2020", + kind: "T2000", + summary: none, + abstract: none, + keywords: ("IT", "other stuff"), + bibliography: none, + glossary: none, + appendices: none, + ), +)) diff --git a/tests/invalid-config/test-case-3.typ b/tests/invalid-config/test-case-3.typ index ef42dd8..f274b60 100644 --- a/tests/invalid-config/test-case-3.typ +++ b/tests/invalid-config/test-case-3.typ @@ -1,24 +1,26 @@ #import "../../src/lib.typ": dhbw-template -#show: dhbw-template.with( - config: ( - lang: "en", - region: "en", - author: ( - university: "DHBW Mannheim", - company: "ABB AG", - supervisor: none, - matriculation-number: 123456789), - thesis: ( - title: "Unofficial ABB/DHBW Typst template", - subtitle: "for reports and thesises", - submission-date: "23rd march 2020", - timeframe: "1st january 2020 - 20th march 2020", - kind: "T2000", - summary: none, - abstract: none, - keywords: ( "IT", "other stuff" ), - bibliography: none, - glossary: none, - appendices: none))) +#show: dhbw-template.with(( + lang: "en", + region: "en", + author: ( + university: "DHBW Mannheim", + company: "ABB AG", + supervisor: none, + matriculation-number: 123456789, + ), + thesis: ( + title: "Unofficial ABB/DHBW Typst template", + subtitle: "for reports and thesises", + submission-date: "23rd march 2020", + timeframe: "1st january 2020 - 20th march 2020", + kind: "T2000", + summary: none, + abstract: none, + keywords: ("IT", "other stuff"), + bibliography: none, + glossary: none, + appendices: none, + ), +)) diff --git a/tests/local-import/main.typ b/tests/local-import/main.typ index 89d1865..169829d 100644 --- a/tests/local-import/main.typ +++ b/tests/local-import/main.typ @@ -1,7 +1,7 @@ #import "../../src/lib.typ": dhbw-template -#show: dhbw-template(( +#show: dhbw-template.with(( lang: "en", region: "en", author: ( @@ -23,6 +23,4 @@ glossary: none, appendices: none, ), -))[ - test -] +))