Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
9db859c1
Commit
9db859c1
authored
Jul 18, 2011
by
Andreas Schiffler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed SDL_SetError() by making NULL fmt a no-op, update test automation
parent
73bd015b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
SDL_error.c
src/SDL_error.c
+3
-0
testplatform.c
test/test-automation/testplatform/testplatform.c
+41
-2
No files found.
src/SDL_error.c
View file @
9db859c1
...
...
@@ -55,6 +55,9 @@ SDL_SetError(const char *fmt, ...)
va_list
ap
;
SDL_error
*
error
;
/* Ignore call if invalid format pointer was passed */
if
(
fmt
==
NULL
)
return
;
/* Copy in the key, mark error as valid */
error
=
SDL_GetErrBuf
();
error
->
error
=
1
;
...
...
test/test-automation/testplatform/testplatform.c
View file @
9db859c1
...
...
@@ -352,13 +352,52 @@ int platform_testSetErrorEmptyInput(void *arg)
int
platform_testSetErrorInvalidInput
(
void
*
arg
)
{
const
char
*
testError
=
NULL
;
const
char
*
probeError
=
"Testing"
;
char
*
lastError
;
int
len
;
// Reset
SDL_ClearError
();
// Check for no-op
SDL_SetError
(
testError
);
AssertPass
(
"SDL_SetError()"
);
lastError
=
(
char
*
)
SDL_GetError
();
AssertTrue
(
lastError
!=
NULL
,
"SDL_GetError() != NULL"
);
if
(
lastError
!=
NULL
)
{
len
=
strlen
(
lastError
);
AssertTrue
(
len
==
0
,
"SDL_GetError(): expected message len 0, was len: %i"
,
0
,
len
);
AssertTrue
(
strcmp
(
lastError
,
""
)
==
0
,
"SDL_GetError(): expected message '', was message: '%s'"
,
lastError
);
}
// Set
SDL_SetError
(
probeError
);
// Check for no-op
SDL_SetError
(
testError
);
AssertPass
(
"SDL_SetError()"
);
lastError
=
(
char
*
)
SDL_GetError
();
AssertTrue
(
lastError
==
NULL
,
"SDL_GetError() == NULL"
);
AssertTrue
(
lastError
!=
NULL
,
"SDL_GetError() != NULL"
);
if
(
lastError
!=
NULL
)
{
len
=
strlen
(
lastError
);
AssertTrue
(
len
==
strlen
(
probeError
),
"SDL_GetError(): expected message len %i, was len: %i"
,
strlen
(
probeError
),
len
);
AssertTrue
(
strcmp
(
lastError
,
probeError
)
==
0
,
"SDL_GetError(): expected message '%s', was message: '%s'"
,
probeError
,
lastError
);
}
// Clean up
SDL_ClearError
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment