Skip to content

Commit f519c76

Browse files
committed
Fix test in documentation.
Remove commenting-out of const_float_from_string tests of invalid inputs. That was not meant to be committed.
1 parent c603ab1 commit f519c76

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/types/int_type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ impl IntType {
258258
///
259259
/// assert_eq!(i8_val.print_to_string().to_string(), "i8 121");
260260
///
261-
/// let i8_val = i8_type.const_int_from_string("0121", StringRadix::from_u8(10).unwrap());
261+
/// let i8_val = i8_type.const_int_from_string("0121", StringRadix::from_u8(10).unwrap()).unwrap();
262262
///
263263
/// assert_eq!(i8_val.print_to_string().to_string(), "i8 16");
264264
///
265-
/// // Unsafe executions, LLVM may terminate with an assertion failure or
266-
/// // execute undefined behaviour in C++ code.
267265
/// let i8_val = i8_type.const_int_from_string("0121", StringRadix::Binary);
266+
/// assert!(i8_val.is_none());
268267
///
269268
/// let i8_val = i8_type.const_int_from_string("ABCD", StringRadix::Binary);
269+
/// assert!(i8_val.is_none());
270270
/// ```
271271
pub fn const_int_from_string(&self, slice: &str, radix: StringRadix) -> Option<IntValue> {
272272
if !radix.to_regex().is_match(slice) {

tests/all/test_values.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,15 +738,14 @@ fn test_value_from_string() {
738738
let f64_val = f64_type.const_float_from_string("3");
739739

740740
assert_eq!(f64_val.print_to_string().to_string(), "double 3.000000e+00");
741-
/*
741+
742742
let f64_val = f64_type.const_float_from_string("");
743743

744744
assert_eq!(f64_val.print_to_string().to_string(), "double 0.000000e+00");
745745

746746
let f64_val = f64_type.const_float_from_string("3.asd");
747747

748748
assert_eq!(f64_val.print_to_string().to_string(), "double 0x7FF0000000000000");
749-
*/
750749
}
751750

752751
#[test]

0 commit comments

Comments
 (0)