-
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 9326ef1
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
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() |