ct_testspec(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

✨ ct_testspec ✨

okay bestie, welcome to ct_testspec β€” that's the ct_testspec(3) module from the Erlang Common Test world πŸ’– it's a tiny little helper module, but it's doing the absolute most when it comes to reading test specs, no cap.


🌸 DESCRIPTION 🌸

This module exports help functions for parsing of test specifications. that's it, that's the whole vibe β€” it's the parser bestie who reads your test spec files and tells you what's up πŸŽ€


πŸ¦‹ FUNCTIONS πŸ¦‹

πŸ’… get_tests(Specs) -> {ok, [{Specs, Tests}]} | {error, Reason}

and here's the type tea, verbatim, because we do NOT play with type specs 🫢:

get_tests(Specs) -> {ok, [{Specs, Tests}]} | {error, Reason}
                   when
                       Specs :: [string()] | [[string()]],
                       Tests :: {Node, Run, Skip},
                       Node :: atom(),
                       Run :: {Dir, Suites, Cases},
                       Skip ::
                           {Dir, Suites, Comment} |
                           {Dir, Suites, Cases, Comment},
                       Dir :: string(),
                       Suites :: atom | [atom()] | all,
                       Cases :: atom | [atom()] | all,
                       Comment :: string(),
                       Reason :: term().

Parse the given test specification files and return the tests to run and skip. literally its whole job, and it slays at it πŸ’–

so here's the thing β€” the shape of what you pass in matters, and it changes the vibe completely:

  • If SpecsIn=[Spec1,Spec2,...], separate tests will be created per specification. one test each, everybody gets their own moment ✨
  • If SpecsIn=[[Spec1,Spec2,...]], all specifications will be merge into one test. one big group hug, one single test πŸ«‚

For each test, a {Specs,Tests} element is returned, where:

  • Specs is a list of all included test specifications,
  • and Tests specifies actual tests to run/skip per node πŸ‘‘
ngl the nesting on that input is doing the absolute most β€” [string()] vs [[string()]] is one little bracket standing between "separate tests" and "one merged test", so look at it twice before you blame the parser 😭

and that's the whole module, bestie β€” small, focused, iconic, main character energy in a 60-line file πŸ‘‘

Ericsson AB made this one, it shipped as part of common_test version 1.31.1, and this page is dated ct_testspec(3). mwah, periodt πŸ’‹πŸ’–

πŸ“¦ where this page comes from