Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Contexts to allow easier hierarchical tests #938

pesse opened this issue Jun 14, 2019 · 0 comments · Fixed by #1013


Copy link

@pesse pesse commented Jun 14, 2019

To make it easier to structure the tests (as described in this video by Kevlin Henney: it would be great to allow nesting of contexts:

create or replace package queue_spec as
  -- %suite(Queue Spec)
  -- %context(a_not_empty_queue)
    -- %context(that_is_not_full)
      -- %test
      procedure becomes_longer_when_non_null_value_enqueued;
      -- %test
      procedure becomes_full_when_enqueued_up_to_capacity;
    -- %endcontext
    -- %context(that_is_full)
      -- %test
      procedure ignores_further_enqueued_values;
      -- %test
      procedure becomes_non_full_when_dequeued;
    -- %endcontext

    -- %test
    procedure dequeues_values_in_order_enqueued;

  -- %endcontext

Leading to

Queue Spec
      becomes_longer_when_non_null_value_enqueued [SUCCESS]
      becomes_full_when_enqueued_up_to_capacity [SUCCESS]
      ignores_further_enqueued_values [SUCCESS]
      becomes_non_full_when_dequeued [SUCCESS]
    dequeues_values_in_order_enqueued [SUCCESS]

What to do in case of missing endcontext?
Write a warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.