-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b336542
commit e6586d6
Showing
6 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,3 +90,40 @@ check-github-actions-workflows-linting: | |
RUN go install github.com/rhysd/actionlint/cmd/[email protected] | ||
DO +COPY_CI_DATA | ||
RUN ./ci/check-github-actions-workflows-linting.sh | ||
|
||
|
||
COPY_SOURCECODE: | ||
COMMAND | ||
COPY "./zsh-simple-abbreviations.zsh" "./zsh-simple-abbreviations.zsh" | ||
COPY "./src" "./src" | ||
COPY "./end-to-end-tests" "./end-to-end-tests" | ||
|
||
|
||
e2e-test: | ||
BUILD +setting-abbreviation-e2e-test | ||
BUILD +unsetting-abbreviation-e2e-test | ||
BUILD +no-space-does-not-expand-abbreviation-e2e-test | ||
|
||
|
||
e2e-test-base: | ||
FROM python:3.9.18 | ||
DO +COPY_SOURCECODE | ||
# https://askubuntu.com/questions/462690/what-does-apt-get-fix-missing-do-and-when-is-it-useful | ||
RUN apt-get update --fix-missing | ||
RUN apt-get install zsh -y | ||
RUN pip3 install -r end-to-end-tests/requirements.txt | ||
|
||
|
||
setting-abbreviation-e2e-test: | ||
FROM +e2e-test-base | ||
RUN python3 end-to-end-tests/setting-abbreviation.py | ||
|
||
|
||
unsetting-abbreviation-e2e-test: | ||
FROM +e2e-test-base | ||
RUN python3 end-to-end-tests/unsetting-abbreviation.py | ||
|
||
|
||
no-space-does-not-expand-abbreviation-e2e-test: | ||
FROM +e2e-test-base | ||
RUN python3 end-to-end-tests/no-space-does-not-expand-abbreviation.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pexpect | ||
import os | ||
|
||
|
||
full_path = os.path.realpath(__file__) | ||
test_directory = os.path.dirname(full_path) | ||
|
||
zsh = pexpect.spawnu('/usr/bin/env zsh --no-rcs', | ||
env=os.environ | {'PROMPT': '>'}) | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
# Source the plugin and add an abbreviation. | ||
zsh.sendline( | ||
f"source \"{test_directory}/../zsh-simple-abbreviations.zsh\" && zsh-simple-abbreviations --set H 'hello'") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
before = zsh.after | ||
# Use the abbreviation. | ||
zsh.sendline("echo H") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
output = (before + zsh.before) | ||
|
||
# Assert the abbreviation was expanded to 'hello'. | ||
assert "hello" not in output | ||
|
||
# Done with test close Zsh. | ||
zsh.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pexpect==4.9.0 | ||
ptyprocess==0.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pexpect | ||
import os | ||
|
||
|
||
full_path = os.path.realpath(__file__) | ||
test_directory = os.path.dirname(full_path) | ||
|
||
zsh = pexpect.spawnu('/usr/bin/env zsh --no-rcs', | ||
env=os.environ | {'PROMPT': '>'}) | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
# Source the plugin and add an abbreviation. | ||
zsh.sendline( | ||
f"source \"{test_directory}/../zsh-simple-abbreviations.zsh\" && zsh-simple-abbreviations --set H 'hello'") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
before = zsh.after | ||
# Use the abbreviation. | ||
zsh.sendline("echo H ") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
output = (before + zsh.before) | ||
|
||
# Assert the abbreviation was expanded to 'hello'. | ||
assert "hello" in output | ||
|
||
# Done with test close Zsh. | ||
zsh.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import pexpect | ||
import os | ||
|
||
|
||
full_path = os.path.realpath(__file__) | ||
test_directory = os.path.dirname(full_path) | ||
|
||
zsh = pexpect.spawnu('/usr/bin/env zsh --no-rcs', | ||
env=os.environ | {'PROMPT': '>'}) | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
# Source the plugin and set an abbreviation. | ||
zsh.sendline( | ||
f"source \"{test_directory}/../zsh-simple-abbreviations.zsh\" && zsh-simple-abbreviations --set H 'hello'") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
before = zsh.after | ||
# Use the abbreviation. | ||
zsh.sendline("echo H ") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
output = (before + zsh.before) | ||
# Assert the abbreviation was expanded to 'hello'. | ||
assert "hello" in output | ||
# Unset the abbreviation. | ||
zsh.sendline("zsh-simple-abbreviations --unset H") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
before = zsh.after | ||
# Use the abbreviation. | ||
zsh.sendline("echo H ") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
output = (before + zsh.before) | ||
# Assert abbreviation was unset. | ||
assert "hello" not in output | ||
|
||
# Done with test close Zsh. | ||
zsh.close() |