mirror of
https://github.com/openharmony/third_party_rust_encoding_rs.git
synced 2026-06-30 21:17:58 -04:00
adjust code generation to make tests bail out early in Miri
This commit is contained in:
@@ -1446,12 +1446,20 @@ single_byte_file.write("""
|
||||
#[test]
|
||||
fn test_single_byte_decode() {""")
|
||||
|
||||
idx = 0 # for Miri, return after 2nd test
|
||||
for name in preferred:
|
||||
if name == u"ISO-8859-8-I":
|
||||
continue;
|
||||
if is_single_byte(name):
|
||||
single_byte_file.write("""
|
||||
decode_single_byte(%s, &data::SINGLE_BYTE_DATA.%s);""" % (to_constant_name(name), to_snake_name(name)))
|
||||
idx += 1
|
||||
if idx == 2:
|
||||
single_byte_file.write("""
|
||||
if cfg!(miri) {
|
||||
// Miri is too slow
|
||||
return;
|
||||
}""")
|
||||
|
||||
single_byte_file.write("""
|
||||
}
|
||||
@@ -1459,12 +1467,21 @@ single_byte_file.write("""
|
||||
#[test]
|
||||
fn test_single_byte_encode() {""")
|
||||
|
||||
|
||||
idx = 0 # for Miri, return after 2nd test
|
||||
for name in preferred:
|
||||
if name == u"ISO-8859-8-I":
|
||||
continue;
|
||||
if is_single_byte(name):
|
||||
single_byte_file.write("""
|
||||
encode_single_byte(%s, &data::SINGLE_BYTE_DATA.%s);""" % (to_constant_name(name), to_snake_name(name)))
|
||||
idx += 1
|
||||
if idx == 2:
|
||||
single_byte_file.write("""
|
||||
if cfg!(miri) {
|
||||
// Miri is too slow
|
||||
return;
|
||||
}""")
|
||||
|
||||
|
||||
single_byte_file.write("""
|
||||
|
||||
+8
-2
@@ -645,7 +645,10 @@ mod tests {
|
||||
fn test_single_byte_decode() {
|
||||
decode_single_byte(IBM866, &data::SINGLE_BYTE_DATA.ibm866);
|
||||
decode_single_byte(ISO_8859_10, &data::SINGLE_BYTE_DATA.iso_8859_10);
|
||||
if cfg!(miri) { return; } // Miri is too slow
|
||||
if cfg!(miri) {
|
||||
// Miri is too slow
|
||||
return;
|
||||
}
|
||||
decode_single_byte(ISO_8859_13, &data::SINGLE_BYTE_DATA.iso_8859_13);
|
||||
decode_single_byte(ISO_8859_14, &data::SINGLE_BYTE_DATA.iso_8859_14);
|
||||
decode_single_byte(ISO_8859_15, &data::SINGLE_BYTE_DATA.iso_8859_15);
|
||||
@@ -677,7 +680,10 @@ mod tests {
|
||||
fn test_single_byte_encode() {
|
||||
encode_single_byte(IBM866, &data::SINGLE_BYTE_DATA.ibm866);
|
||||
encode_single_byte(ISO_8859_10, &data::SINGLE_BYTE_DATA.iso_8859_10);
|
||||
if cfg!(miri) { return; } // Miri is too slow
|
||||
if cfg!(miri) {
|
||||
// Miri is too slow
|
||||
return;
|
||||
}
|
||||
encode_single_byte(ISO_8859_13, &data::SINGLE_BYTE_DATA.iso_8859_13);
|
||||
encode_single_byte(ISO_8859_14, &data::SINGLE_BYTE_DATA.iso_8859_14);
|
||||
encode_single_byte(ISO_8859_15, &data::SINGLE_BYTE_DATA.iso_8859_15);
|
||||
|
||||
Reference in New Issue
Block a user