Skip to content

Commit

Permalink
Tests: Add test for piping commands in action()
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Holecek <hluk@email.cz>
  • Loading branch information
hluk committed Oct 20, 2018
1 parent 10c7b3d commit 629f584
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tests/tests.cpp
Expand Up @@ -1500,6 +1500,24 @@ void Tests::classTemporaryFile()
QVERIFY( !QFile::exists(QString::fromUtf8(fileName)) );
}

void Tests::pipingCommands()
{
const auto tab = testTab(1);
const Args args = Args("tab") << tab << "separator" << ",";

RUN(args << "action"
<< "copyq print HELLO | copyq print(str(input()).toLowerCase())", "");
WAIT_ON_OUTPUT(args << "read" << "0" << "1", "hello,");

RUN(args << "action"
<< "copyq print TEST"
" | copyq 'print(str(input()) + 1)'"
" | copyq 'print(str(input()) + 2)'"
" | copyq 'print(str(input()) + 3)'"
, "");
WAIT_ON_OUTPUT(args << "read" << "0" << "1", "TEST123,hello");
}

void Tests::chainingCommands()
{
const auto tab1 = testTab(1);
Expand Down
2 changes: 2 additions & 0 deletions src/tests/tests.h
Expand Up @@ -133,6 +133,8 @@ private slots:
void classDir();
void classTemporaryFile();

void pipingCommands();

void chainingCommands();

void configMaxitems();
Expand Down

0 comments on commit 629f584

Please sign in to comment.