Skip to content

Commit ec72db8

Browse files
flowergrassdpgeorge
authored andcommitted
tests: Improve warning.c test coverage.
1 parent 26f00ff commit ec72db8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

tests/unix/extra_coverage.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ementation
3838
# runtime utils
3939
TypeError: can't convert str to int
4040
TypeError: unsupported types for : 'str', 'str'
41+
Warning: test
4142
('0123456789', b'0123456789')
4243
7300
4344
7300

unix/coverage.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "py/repl.h"
77
#include "py/mpz.h"
88
#include "py/builtin.h"
9+
#include "py/emit.h"
910

1011
#if defined(MICROPY_UNIX_COVERAGE)
1112

@@ -130,6 +131,11 @@ STATIC mp_obj_t extra_coverage(void) {
130131
mp_call_function_2_protected(MP_OBJ_FROM_PTR(&mp_builtin_divmod_obj), mp_obj_new_str("abc", 3, false), mp_obj_new_str("abc", 3, false));
131132
}
132133

134+
// warning
135+
{
136+
mp_emitter_warning(MP_PASS_CODE_SIZE, "test");
137+
}
138+
133139
// return a tuple of data for testing on the Python side
134140
mp_obj_t items[] = {(mp_obj_t)&str_no_hash_obj, (mp_obj_t)&bytes_no_hash_obj};
135141
return mp_obj_new_tuple(MP_ARRAY_SIZE(items), items);

0 commit comments

Comments
 (0)