Test::Mouse(3pm)

πŸ’– Test::Mouse(3pm) β€” the cute little test helper for Mouse πŸ’–

Okay so bestie, this is the manual page for Test::Mouse, straight out of the User Contributed Perl Documentation section of the perl man pages. It's a Perl module, and it's literally just a grab-bag of test functions for Mouse-specific stuff. Let's get into it 🐭✨


🌸 NAME 🌸

Test::Mouse β€” test functions for Mouse-specific features, no cap πŸ’…


✨ SYNOPSIS ✨

Like, here's the whole vibe in code. Copy it exactly, bestie:

use Test::More plan => 1;
use Test::Mouse;

meta_ok($class_or_obj, "... Foo has a ->meta");
does_ok($class_or_obj, $role, "... Foo does the Baz role");
has_attribute_ok($class_or_obj, $attr_name, "... Foo has the 'bar' attribute");

πŸ¦‹ DESCRIPTION πŸ¦‹

This module hands you some genuinely useful test functions for classes built on Mouse. 🐭

And listen β€” it's an experimental first release, so like... comments and suggestions are very welcome? Seriously, the author wants your feedback, don't be shy 🫢


πŸ‘‘ EXPORTED FUNCTIONS πŸ‘‘

Here's where it gets good. Every single one of these gets exported for you:

  • meta_ok ($class_or_object) β€” checks whether a class or an object actually has a metaclass. That's it, that's the whole test. βœ…
  • does_ok ($class_or_object, $role, ?$message) β€” checks whether a class or object does a certain role. It's giving very much the same energy as what isa_ok does for the isa method πŸŽ€
  • has_attribute_ok($class_or_object, $attr_name, ?$message) β€” checks whether a class or object has a certain attribute. Basically the attribute version of what can_ok does for methods ✨
  • with_immutable { CODE } @class_names β€” okay this one's fun: it runs CODE twice (and heads up, CODE *which should contain normal tests), and it makes each class in @class_names immutable between the two runs. Like a before/after glow-up for your classes πŸ’…
Fr fr, note that odd *which should contain normal tests) in there β€” that's how it's written in the original, so we're keeping it exactly as-is. Not me fixing it πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

Go read these too, iykyk:

  • Mouse
  • Test::Moose
  • Test::More

So yeah β€” that's the whole page, bestie. This one came from perl v5.42.2 and it's dated 2026-04-21, filed under the User Contributed Perl Documentation section, and the footer says Test::Mouse(3pm) in case you forgot where you were πŸ’– Happy testing, mwah πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from