diff --git a/.github/workflows/dejagnu.yml b/.github/workflows/dejagnu.yml new file mode 100644 index 000000000..b0364ecc4 --- /dev/null +++ b/.github/workflows/dejagnu.yml @@ -0,0 +1,22 @@ +name: DejaGnu Tests + +on: [ push, pull_request ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Install Fish shell and DejaGnu + run: | + sudo apt-get update + sudo apt-get install -y fish dejagnu + - name: Check versions + run: | + fish --version + runtest --version + - name: Checkout + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v2 + - name: Run DejaGnu fish tests + run: | + cd src/test/dejagnu.fishtests + ./runCompletion diff --git a/docs/man/index.html b/docs/man/index.html index d2a045cc5..ff8bc783e 100644 --- a/docs/man/index.html +++ b/docs/man/index.html @@ -435,81 +435,81 @@ #footer-text{color:rgba(0,0,0,.6);font-size:.9em}} @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} - - - + + + diff --git a/docs/zh/picocli-2.0-do-more-with-less.html b/docs/zh/picocli-2.0-do-more-with-less.html index beba3896a..1e37c9a85 100644 --- a/docs/zh/picocli-2.0-do-more-with-less.html +++ b/docs/zh/picocli-2.0-do-more-with-less.html @@ -525,81 +525,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html b/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html index dd1f0061a..3001a2378 100644 --- a/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html +++ b/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html @@ -525,81 +525,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/src/test/dejagnu.fishtests/completion/basicExample.exp b/src/test/dejagnu.fishtests/completion/basicExample.exp index eee1b41dd..87b8ad714 100644 --- a/src/test/dejagnu.fishtests/completion/basicExample.exp +++ b/src/test/dejagnu.fishtests/completion/basicExample.exp @@ -19,6 +19,5 @@ run_completion_test $cmd $test $candidates set cmd "basicExample --timeUnit=" set test "Tab should show time unit enum values for '$cmd'" -#set candidates "1 2 3" -set candidates "\u2026timeUnit=DAYS \u2026timeUnit=MICROSECONDS \u2026timeUnit=MINUTES \u2026timeUnit=SECONDS\r\n\u2026timeUnit=HOURS \u2026timeUnit=MILLISECONDS \u2026timeUnit=NANOSECONDS " +set candidates ".*timeUnit=DAYS.*timeUnit=MICROSECONDS.*timeUnit=MINUTES.*timeUnit=SECONDS.*timeUnit=HOURS.*timeUnit=MILLISECONDS.*timeUnit=NANOSECONDS.*" run_completion_test $cmd $test $candidates diff --git a/src/test/dejagnu.fishtests/completion/picocompletion-demo.exp b/src/test/dejagnu.fishtests/completion/picocompletion-demo.exp index b6f4fdfd9..b7fe60c88 100644 --- a/src/test/dejagnu.fishtests/completion/picocompletion-demo.exp +++ b/src/test/dejagnu.fishtests/completion/picocompletion-demo.exp @@ -18,7 +18,6 @@ run_completion_test $cmd $test $candidates # set cmd "picocompletion-demo sub1 " # set test "Tab should not show completions for '${cmd}'" -# there is completion from root level set cmd "picocompletion-demo sub1 -" set test "Tab should show sub1 options for '${cmd}'" set candidates "--candidates.*--candidates=.*--num.*--str.*" diff --git a/src/test/dejagnu.fishtests/lib/completion.exp b/src/test/dejagnu.fishtests/lib/completion.exp index c5df2c1ad..073f24663 100644 --- a/src/test/dejagnu.fishtests/lib/completion.exp +++ b/src/test/dejagnu.fishtests/lib/completion.exp @@ -1,4 +1,8 @@ exp_spawn fish --no-config expect -re "(.+>)" +# Set terminal size to my notebook's resolution +send "stty rows 53 cols 190\r" +expect -re "(.+>)" + source $::srcdir/lib/library.exp diff --git a/src/test/dejagnu.fishtests/lib/library.exp b/src/test/dejagnu.fishtests/lib/library.exp index 670de975f..e2fb3f33f 100644 --- a/src/test/dejagnu.fishtests/lib/library.exp +++ b/src/test/dejagnu.fishtests/lib/library.exp @@ -1,11 +1,11 @@ proc run_completion_test {cmd test candidates} { + exp_internal 1 send "${cmd}\t" expect { -re "(\n${candidates}\u001b)" { pass $test } timeout { fail $test } } - puts "###Output" - puts "$expect_out(1,string)" + exp_internal 0 send "\x03" expect ">" } diff --git a/src/test/dejagnu.fishtests/runCompletion b/src/test/dejagnu.fishtests/runCompletion new file mode 100755 index 000000000..a475f1f18 --- /dev/null +++ b/src/test/dejagnu.fishtests/runCompletion @@ -0,0 +1,3 @@ +#!/bin/bash +mkdir -p log +runtest --outdir log --tool completion diff --git a/src/test/java/picocli/AutoCompleteDejaGnuTest.java b/src/test/java/picocli/AutoCompleteDejaGnuTest.java index 0c2363c98..280baeb50 100644 --- a/src/test/java/picocli/AutoCompleteDejaGnuTest.java +++ b/src/test/java/picocli/AutoCompleteDejaGnuTest.java @@ -67,11 +67,19 @@ public void tryRunDejaGnuCompletionTests() throws Exception { // ignores test if dejagnu not installed org.junit.Assume.assumeTrue("dejagnu must be installed to run this test", isDejaGnuInstalled()); - runDejaGnuCompletionTests(); + runDejaGnuCompletionTests("src/test/dejagnu.tests"); } - private void runDejaGnuCompletionTests() throws Exception { - final File testDir = new File("src/test/dejagnu.tests"); + @Test + public void tryRunFishDejaGnuCompletionTests() throws Exception { + // ignores test if dejagnu not installed + org.junit.Assume.assumeTrue("dejagnu must be installed to run this test", isDejaGnuInstalled()); + runDejaGnuCompletionTests("src/test/dejagnu.fishtests"); + } + + + private void runDejaGnuCompletionTests(String pathname) throws Exception { + final File testDir = new File(pathname); assertTrue(testDir.getAbsolutePath() + " should exist", testDir.exists()); File runCompletionScript = new File(testDir, "runCompletion"); assertTrue(runCompletionScript.getAbsolutePath() + " should exist", runCompletionScript.exists());