Browse Source

tests/unix: Add coverage test for calling mp_obj_new_bytearray.

pull/3608/head
Damien George 7 years ago
parent
commit
923ebe767d
  1. 10
      ports/unix/coverage.c
  2. 2
      tests/unix/extra_coverage.py.exp

10
ports/unix/coverage.c

@ -231,6 +231,16 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf(&mp_plat_print, "%d\n", MP_OBJ_IS_QSTR(mp_obj_str_intern(mp_obj_new_str("intern me", 9))));
}
// bytearray
{
mp_printf(&mp_plat_print, "# bytearray\n");
// create a bytearray via mp_obj_new_bytearray
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(mp_obj_new_bytearray(4, "data"), &bufinfo, MP_BUFFER_RW);
mp_printf(&mp_plat_print, "%.*s\n", bufinfo.len, bufinfo.buf);
}
// mpz
{
mp_printf(&mp_plat_print, "# mpz\n");

2
tests/unix/extra_coverage.py.exp

@ -34,6 +34,8 @@ ementation
(start=1, stop=2, step=3)
# str
1
# bytearray
data
# mpz
1
12345678

Loading…
Cancel
Save