pas2ut(1)

πŸ’… pas2ut β€” the Free Pascal unit-to-unit-test-case conversion tool ✨

okay bestie, gather round, because this little icon of a manual page is pas2ut(1) and it is literally about to save you so much boring typing 🫢


🌸 NAME 🌸

pas2ut β€” the Free Pascal unit to unit test case conversion tool. that's it, that's the whole vibe. it takes a unit and ✨converts✨ it into tests. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

pas2ut [options] inputfile [outputfile]

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: pas2ut goes through your input file, hunts down all the classes and routines it can find, and then β€” slay β€” it builds a testcase for every single class and routine hanging out in the interface section of that file. πŸ‘‘

it can spit out either a unit or an include file, dealer's choice. every test it creates comes with a standard fail message, so nothing's ever silently passing on you (we love accountability πŸ’€).

and by default? it's only generating tests for the public, published and default visibility members of your classes. very "we respect your privacy" of it, honestly.


🌈 USAGE 🌈

pas2ut is taking these options at this moment in time, bestie:

  • --defaultclasstest=list β€” give it a comma-separated list of default tests, one set for each class. heads up: every element in that list has to be a valid pascal identifier, or it's not gonna fly. βœ‹
  • --failmessage=Msg β€” sets the message that goes inside the Fail() statement in every single test method. your custom little "girl, this broke" note. πŸ’Œ
  • --limit=list β€” hand it a comma-separated list of global identifiers and it'll only generate tests for those. default behaviour is everything β€” all the global identifiers in the interface section of a unit. no filter, all gas.
  • --prefix=name β€” sets the prefix for your test names (the default is Test β€” yes with a space, icon behaviour). a test gets named after the identifier it tests, with this prefix slapped on the front. ✨
  • --singletestclass β€” one single test class for every class it finds. the default is the opposite: a testcase class per class in the input unit. pick your fighter. πŸ₯Š
  • --skip-classes β€” no test code for classes at all, only functions and procedures. classes said "not today". πŸ™ˆ
  • --skip-declaration β€” skips generating the declarations for the tests, only implementations get made. πŸ’…
  • --skip-default β€” skips tests for default visibility members. normally those get generated right alongside the Public or published members, so this is you saying "actually no".
  • --skip-fail β€” no fail() statements inside the test routine implementations. they just vibe. 🧘
  • --skip-fields β€” no testcases for class fields, only methods and properties. fields are on their own journey now.
  • --skip-functions β€” no tests for functions/procedures, only classes. functions, you're benched. πŸͺ‘
  • --skip-implementation β€” skips generating the (empty) implementation for the tests; you only get a class declaration. it can be completed later in an IDE such as Lazarus or MSIDE, so it's giving "finish it yourself, bestie". πŸŽ€
  • --skip-methods β€” no tests for class methods, only fields and properties.
  • --skip-properties β€” no tests for class properties, only fields and methods.
  • --skip-property-default β€” no default test for each property. sorry to the defaults.
  • --skip-public β€” skips tests for public members. only protected members will be tested, and only if --test-protected is in effect. πŸ‘€
  • --skip-published β€” no tests for published members; only public and default members get tested. published, you're uninvited from the group chat.
  • --skip-register β€” no RegisterTests statement. don't register, it's fine, we're keeping it lowkey.
  • --skip-setup β€” doesn't override the TTestCase.Setup() method in the generated class. πŸ› οΈ
  • --skip-teardown β€” doesn't override the TTestCase.TearDown() method in the generated class. 🧹
  • --skip-unit β€” don't generate a unit, just an include file. simple as.
  • --testparentname=name β€” sets the name of the parent class for the generated test classes. the default is TTestCase, but you can point it at another class name if that's your truth. πŸ‘‘
  • --test-property-bounds β€” generates a GetBounds test for each property. bounds check era. πŸ“
  • --test-property-maxlen β€” generates a MaxLen test for each property. how long is too long? we find out. πŸ“
  • --test-property-notify β€” generates a Notify test for each property. πŸ””
  • --test-property-required β€” generates a Required test for each property. mandatory behaviour only. βœ…
  • --test-protected β€” also generates tests for protected class members. remember, by default tests only get generated for public, published and default visibility members, so this is you going deeper. πŸ•΅οΈ
  • --testunitname=name β€” sets the name of the generated unit. if you don't set it, the default gets taken from the output file name. πŸ’–
  • --tiopf β€” creates tiopf tests. this is literally the same as specifying --default, --bounds, --required, --notify and --maxlen tests all at once. one flag, five jobs, main character energy. πŸ”₯
  • --unittestclassname=name β€” sets the global unit test class name. to be used with --singletestclass, bestie. they're a package deal. 🫢
also, quick note: --limit and --defaultclasstest may be specified multiple times. spam them as much as your heart desires. πŸŽ‰

πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie. take care of your units and they'll take care of you. mwah. πŸ’‹

this was Free Pascal, dated 5 sep 2015 β€” and yes, that's the whole sign-off, no cap. πŸ¦‹βœ¨

πŸ“¦ where this page comes from