mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-07 18:36:09 +08:00
fix failed test
This commit is contained in:
parent
0a9bbebae9
commit
20b4d03143
@ -100,11 +100,11 @@ public:
|
||||
virtual void Run(void)=0; //! Run() method, called when the program is run. Subclass must override this
|
||||
bool GetEnvStr(const char * entry,std::string & result); //! Return an environment variable by name
|
||||
bool GetEnvNum(Bitu want_num,std::string & result); //! Return an environment variable by index
|
||||
Bitu GetEnvCount(void); //! Return the number of enviormental variables
|
||||
Bitu GetEnvCount(void); //! Return the number of environmental variables
|
||||
bool SetEnv(const char * entry,const char * new_string); //! Set environment variable
|
||||
virtual void WriteOut(const char *format, const char * arguments);
|
||||
void WriteOut(const char * format,...); //! Write to standard output
|
||||
int WriteOut_NoParsing(const char * format, bool dbcs = false); //! Write to standard output, no parsing
|
||||
virtual int WriteOut_NoParsing(const char * format, bool dbcs = false); //! Write to standard output, no parsing
|
||||
void ChangeToLongCmd(); //! Get command line from shell instead of PSP
|
||||
void DebugDumpEnv(); //! Dump environment block to log
|
||||
void WriteExitStatus(); //! Write exit status to CPU register AL for return to MS-DOS
|
||||
|
@ -381,7 +381,7 @@ void DOS_Shell::ParseLine(char * line) {
|
||||
uint16_t dummy,dummy2;
|
||||
uint32_t bigdummy = 0;
|
||||
bool append;
|
||||
bool normalstdin = false; /* wether stdin/out are open on start. */
|
||||
bool normalstdin = false; /* whether stdin/out are open on start. */
|
||||
bool normalstdout = false; /* Bug: Assumed is they are "con" */
|
||||
|
||||
GetRedirection(line, &in, &out, &toc, &append);
|
||||
|
@ -1278,7 +1278,6 @@ void DOS_Shell::CMD_ECHO(char * args){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DOS_Shell::CMD_EXIT(char * args) {
|
||||
HELP("EXIT");
|
||||
exit = true;
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
*/
|
||||
MOCK_METHOD(bool, execute_shell_cmd, (char *name, char *arguments), (override));
|
||||
MOCK_METHOD(void, WriteOut, (const char *format, const char *arguments), (override));
|
||||
MOCK_METHOD(int, WriteOut_NoParsing, (const char * format, bool dbcs), (override));
|
||||
|
||||
private:
|
||||
DOS_Shell real_; // Keeps an instance of the real in the mock.
|
||||
@ -137,7 +138,7 @@ TEST_F(DOS_Shell_CMDSTest, CMD_ECHO_off_on)
|
||||
{
|
||||
MockDOS_Shell shell;
|
||||
EXPECT_TRUE(shell.echo); // should be the default
|
||||
EXPECT_CALL(shell, WriteOut(_, _)).Times(0);
|
||||
EXPECT_CALL(shell, WriteOut_NoParsing(_, true)).Times(0);
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>("OFF")); });
|
||||
EXPECT_FALSE(shell.echo);
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>("ON")); });
|
||||
@ -149,18 +150,18 @@ TEST_F(DOS_Shell_CMDSTest, CMD_ECHO_space_handling)
|
||||
MockDOS_Shell shell;
|
||||
|
||||
EXPECT_TRUE(shell.echo);
|
||||
EXPECT_CALL(shell, WriteOut(_, StrEq("OFF "))).Times(1);
|
||||
EXPECT_CALL(shell, WriteOut_NoParsing(StrEq("OFF "), true)).Times(1);
|
||||
// this DOES NOT trigger ECHO OFF (trailing space causes it to not)
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>(" OFF ")); });
|
||||
EXPECT_TRUE(shell.echo);
|
||||
|
||||
EXPECT_CALL(shell, WriteOut(_, StrEq("FF "))).Times(1);
|
||||
EXPECT_CALL(shell, WriteOut_NoParsing(StrEq("FF "), true)).Times(1);
|
||||
// this DOES NOT trigger ECHO OFF (initial 'O' gets stripped)
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>("OFF ")); });
|
||||
EXPECT_TRUE(shell.echo);
|
||||
|
||||
// no trailing space, echo off should work
|
||||
EXPECT_CALL(shell, WriteOut(_, _)).Times(0);
|
||||
EXPECT_CALL(shell, WriteOut_NoParsing(_, true)).Times(0);
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>(" OFF")); });
|
||||
// check that OFF worked properly, despite spaces
|
||||
EXPECT_FALSE(shell.echo);
|
||||
@ -168,7 +169,7 @@ TEST_F(DOS_Shell_CMDSTest, CMD_ECHO_space_handling)
|
||||
// NOTE: the expected string here is missing the leading char of the
|
||||
// input to ECHO. the first char is stripped as it's assumed it will be
|
||||
// a space, period or slash.
|
||||
EXPECT_CALL(shell, WriteOut(_, StrEq(" HI "))).Times(1);
|
||||
EXPECT_CALL(shell, WriteOut_NoParsing(StrEq(" HI "), true)).Times(1);
|
||||
EXPECT_NO_THROW({ shell.CMD_ECHO(const_cast<char *>(". HI ")); });
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user