1
0
mirror of https://github.com/yorukot/superfile.git synced 2025-02-06 09:44:40 +00:00

feat: add testscases for new changes
All checks were successful
Go / build (push) Successful in 10m5s

This commit is contained in:
Nitin Kumar 2025-02-03 22:20:53 +05:30
parent 29f78fedaa
commit a0bef3527c
5 changed files with 51 additions and 2 deletions

View File

@ -72,7 +72,7 @@ Notes
## Tips while running tests
- Use `-d` or `--debug` to enable debug logs during test run.
- If you see flakiness in test runs due to superfile being still open, consider using `--close-wait-time` options to increase wait time for superfile to close
- Make sure that your hotkeys are set to default hotkeys. Tests use default hotkeys for now.
- Use `-t` or `--tests` to only run specific tests
- Example `python main.py -d -t RenameTest CopyTest`
- If you see `libtmux` errors like `libtmux.exc.LibTmuxException: ['no server running on /private/tmp/tmux-501/superfile']` Make sure your python version is up to date

View File

@ -32,6 +32,7 @@ KEY_CTRL_D : Keys = CtrlKeys('d')
KEY_CTRL_M : Keys = CtrlKeys('m')
KEY_CTRL_R : Keys = CtrlKeys('r')
KEY_CTRL_V : Keys = CtrlKeys('v')
KEY_CTRL_W : Keys = CtrlKeys('w')
KEY_CTRL_X : Keys = CtrlKeys('x')
# See https://vimdoc.sourceforge.net/htmldoc/digraph.html#digraph-table for key codes

View File

@ -0,0 +1,23 @@
from pathlib import Path
from core.base_test import GenericTestImpl
from core.environment import Environment
import core.test_constants as tconst
import core.keys as keys
TESTROOT = Path("copyw_ops")
FILE1 = TESTROOT / "file1.txt"
FILE1_COPY1 = TESTROOT / "file1(1).txt"
class CopyWTest(GenericTestImpl):
def __init__(self, test_env : Environment):
super().__init__(
test_env=test_env,
test_root=TESTROOT,
start_dir=TESTROOT,
test_dirs=[TESTROOT],
test_files=[(FILE1, tconst.FILE_TEXT1)],
key_inputs=[keys.KEY_CTRL_C, keys.KEY_CTRL_W],
validate_exists=[FILE1, FILE1_COPY1]
)

View File

@ -0,0 +1,26 @@
from pathlib import Path
from core.base_test import GenericTestImpl
from core.environment import Environment
import core.test_constants as tconst
import core.keys as keys
TESTROOT = Path("delete_dir")
DIR1 = TESTROOT / "dir1"
NESTED_DIR1 = DIR1 / "nested1"
NESTED_DIR2 = DIR1 / "nested2"
FILE1 = NESTED_DIR1 / "file1.txt"
class DeleteDirTest(GenericTestImpl):
def __init__(self, test_env : Environment):
super().__init__(
test_env=test_env,
test_root=TESTROOT,
start_dir=TESTROOT,
test_dirs=[TESTROOT, DIR1, NESTED_DIR1, NESTED_DIR2],
test_files=[(FILE1, tconst.FILE_TEXT1)],
key_inputs=[keys.KEY_CTRL_D, keys.KEY_ENTER],
validate_not_exists=[DIR1, NESTED_DIR1, NESTED_DIR2, FILE1]
)

View File

@ -6,7 +6,6 @@ import core.test_constants as tconst
import core.keys as keys
TESTROOT = Path("delete_ops")
# File1 fails in my mac
FILE1 = TESTROOT / "file_to_delete.txt"