mirror of https://github.com/arendst/Tasmota.git
Berry fix string literal
This commit is contained in:
parent
8605ad3cb8
commit
149920e363
|
@ -579,11 +579,14 @@ static int m_init(bvm *vm)
|
|||
if (hex_in) {
|
||||
size_arg = strlen(hex_in) / 2; /* allocate headroom */
|
||||
}
|
||||
}
|
||||
|
||||
/* check if fixed size that we have the right size */
|
||||
if (attr.fixed && size_arg > attr.size) {
|
||||
be_raise(vm, BYTES_RESIZE_ERROR, BYTES_RESIZE_MESSAGE);
|
||||
/* check if fixed size that we have the right size */
|
||||
if (size_arg > attr.size) {
|
||||
if (attr.fixed) {
|
||||
be_raise(vm, BYTES_RESIZE_ERROR, BYTES_RESIZE_MESSAGE);
|
||||
} else {
|
||||
attr.size = size_arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate */
|
||||
|
|
|
@ -7,6 +7,8 @@ b=bytes(0)
|
|||
assert(str(b) == "bytes('')")
|
||||
b=bytes(1)
|
||||
assert(str(b) == "bytes('')")
|
||||
b=bytes(-1)
|
||||
assert(str(b) == "bytes('')")
|
||||
assert(b.size() == 0)
|
||||
|
||||
b=bytes("a")
|
||||
|
@ -164,3 +166,5 @@ b=bytes()
|
|||
b.fromstring("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
|
||||
assert(str(b) =="bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73...')")
|
||||
assert(b.tostring(0) =="bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742C2073656420646F20656975736D6F642074656D706F7220696E6369646964756E74207574206C61626F726520657420646F6C6F7265206D61676E6120616C697175612E')")
|
||||
|
||||
assert(size(bytes('4C6F72656D20697073756D20646F6C6F722073697420616D65742C20636F6E73656374657475722061646970697363696E6720656C69742C2073656420646F20656975736D6F642074656D706F7220696E6369646964756E74207574206C61626F726520657420646F6C6F7265206D61676E6120616C697175612E')) == 123)
|
||||
|
|
Loading…
Reference in New Issue