Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cpp refactor] Create //cpp/osh and associated test
Fix bin/osh_eval dependencies
- Loading branch information
Andy C
committed
Nov 13, 2022
1 parent
a959ba4
commit f8a9a8c
Showing
5 changed files
with
58 additions
and
23 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
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,35 @@ | ||
#include "cpp/osh.h" | ||
#include "cpp/core_error.h" | ||
#include "mycpp/runtime.h" | ||
#include "vendor/greatest.h" | ||
|
||
TEST bool_stat_test() { | ||
int fail = 0; | ||
try { | ||
bool_stat::isatty(StrFromC("invalid"), nullptr); | ||
} catch (error::FatalRuntime* e) { | ||
fail++; | ||
} | ||
ASSERT_EQ(1, fail); | ||
|
||
bool b2 = bool_stat::isatty(StrFromC("0"), nullptr); | ||
// This will be true interactively | ||
log("stdin isatty = %d", b2); | ||
|
||
PASS(); | ||
} | ||
|
||
GREATEST_MAIN_DEFS(); | ||
|
||
int main(int argc, char** argv) { | ||
gHeap.Init(); | ||
|
||
GREATEST_MAIN_BEGIN(); | ||
|
||
RUN_TEST(bool_stat_test); | ||
|
||
gHeap.CleanProcessExit(); | ||
|
||
GREATEST_MAIN_END(); | ||
return 0; | ||
} |