Tests: assert exact columns, padding and corner span in js and tools tests

Five assertions accepted any positive value, so a wrong result could pass:

- host_tests: the evaluator site column and the thrown error's column are
  now 3, where the indented call and throw start.
- promise_tests: rejections relayed through Promise.all, Promise.race and
  a catch handler report column 3, not any column above 0.
- xmp_tests: the sample packet's padding is exactly 1.
- corners tests: a 10 pt radius at a 120 degree polygon corner spans
  10 pt, within 1e-6, instead of anything in (5, 10.5].
This commit is contained in:
dotCooCoo committed 2026-12-01 02:13:46 -08:00
1 parent e5bdd539d0
commit 8f5eb5435f
4 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -476,7 +476,7 @@ fn an_evaluator_with_site_is_told_where_it_is_called() {
assert_eq!(given.len(), 2, "{given:?}");
assert_eq!(given[0].len(), 4, "{given:?}");
assert_eq!((&given[0][..2], &given[0][3]), (&[Data::Number(tag), Data::Number(3.0)][..], &Data::String("x".into())), "{given:?}");
assert!(matches!(given[0][2], Data::Number(c) if c >= 1.0), "{given:?}");
assert_eq!(given[0][2], Data::Number(3.0), "{given:?}");
assert_eq!(given[1], vec![Data::String("y".into())]);
}
@@ -615,7 +615,7 @@ fn an_error_says_where_in_the_source_it_was_raised() {
r.start("var a = 1;\n throw new TypeError('no');").unwrap();
let e = finish(&mut r, 1).0.unwrap_err();
assert_eq!((e.kind, e.line), (RunErrorKind::Thrown, 2));
assert!(e.column >= 3, "{}", e.column);
assert_eq!(e.column, 3);
assert_eq!(e.message, "TypeError: no");
}
+2 -2
View File
@@ -369,7 +369,7 @@ fn combinator_rejection_relays_keep_the_input_location() {
let reported = r.unhandled_rejections();
assert_eq!(reported.len(), 1, "{method}: {reported:?}");
assert_eq!(reported[0].line, 2, "{method}: {:?}", reported[0]);
assert!(reported[0].column > 0);
assert_eq!(reported[0].column, 3, "{method}: {:?}", reported[0]);
assert_eq!(reported[0].tag, r.script_tag());
}
let mut r = realm();
@@ -377,7 +377,7 @@ fn combinator_rejection_relays_keep_the_input_location() {
.unwrap();
assert_eq!(r.unhandled_rejections().len(), 1);
assert_eq!(r.unhandled_rejections()[0].line, 3);
assert!(r.unhandled_rejections()[0].column > 0);
assert_eq!(r.unhandled_rejections()[0].column, 3);
let mut r = realm();
r.run("eval(\"Promise.reject('eval')\"); Function(\"Promise.reject('function')\")();").unwrap();
let reported = r.unhandled_rejections();
+1 -1
View File
@@ -113,7 +113,7 @@ fn explicit_empty_and_named_rdf_subjects_cannot_be_merged() {
fn packet_padding_requires_an_actual_wrapper_trailer() {
let packet = r#"<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description xmlns:a="urn:test"><a:value><![CDATA[ <?xpacket end=]]></a:value></rdf:Description></rdf:RDF>"#;
assert_eq!(xmp::pad_size(packet), 0);
assert!(xmp::pad_size(PACKET) > 0);
assert_eq!(xmp::pad_size(PACKET), 1);
let prefixed = format!("<?xml version=\"1.0\"?>\n<!-- prolog -->\n{PACKET}");
assert_eq!(xmp::pad_size(&prefixed), xmp::pad_size(PACKET));
assert_eq!(xmp::pad_size(&format!("<?xpacket-note example?>{PACKET}")), xmp::pad_size(PACKET));
+1 -1
View File
@@ -899,7 +899,7 @@ fn a_polygons_widget_gives_its_cut_and_a_hidden_widget_gives_none() {
assert_eq!(got, id);
// The arc of a 10 pt radius at a 120° corner spans 10 pt between its ends.
let (wide, high) = (b[2] - b[0], b[3] - b[1]);
assert!(wide.max(high) <= 10.5 && wide.max(high) > 5.0, "{b:?}");
assert!((wide.max(high) - 10.0).abs() < 1e-6, "{b:?}");
let centre = Point::new((b[0] + b[2]) / 2.0, (b[1] + b[3]) / 2.0);
assert!(centre.distance(at) < 15.0, "{b:?} {at:?}");
// Sheared by 30°: the rectangle's 120° corners (1 and 3) hide above 100°.