diff --git a/psl/psl/tests/attributes/id_positive.rs b/psl/psl/tests/attributes/id_positive.rs index 671c733887e..c8fff4203e7 100644 --- a/psl/psl/tests/attributes/id_positive.rs +++ b/psl/psl/tests/attributes/id_positive.rs @@ -163,7 +163,7 @@ fn should_allow_string_ids_with_ulid() { .assert_has_scalar_field("id") .assert_scalar_type(ScalarType::String) .assert_default_value() - .assert_cuid(); + .assert_ulid(); model.assert_id_on_fields(&["id"]); } diff --git a/psl/psl/tests/common/asserts.rs b/psl/psl/tests/common/asserts.rs index 4d803c8f20b..6d66e41cde7 100644 --- a/psl/psl/tests/common/asserts.rs +++ b/psl/psl/tests/common/asserts.rs @@ -82,6 +82,7 @@ pub(crate) trait DefaultValueAssert { fn assert_constant(&self, val: &str) -> &Self; fn assert_bytes(&self, val: &[u8]) -> &Self; fn assert_now(&self) -> &Self; + fn assert_ulid(&self) -> &Self; fn assert_cuid(&self) -> &Self; fn assert_cuid_version(&self, version: u8) -> &Self; fn assert_uuid(&self) -> &Self; @@ -429,6 +430,12 @@ impl DefaultValueAssert for walkers::DefaultValueWalker<'_> { self } + #[track_caller] + fn assert_ulid(&self) -> &Self { + self.value().assert_ulid(); + self + } + #[track_caller] fn assert_cuid(&self) -> &Self { self.value().assert_cuid(); @@ -634,6 +641,13 @@ impl DefaultValueAssert for ast::Expression { self } + #[track_caller] + fn assert_ulid(&self) -> &Self { + assert!(matches!(self, ast::Expression::Function(name, _, _) if name == "ulid")); + + self + } + #[track_caller] fn assert_cuid(&self) -> &Self { assert!(matches!(self, ast::Expression::Function(name, _, _) if name == "cuid"));