Skip to content

Nested Contexts to allow easier hierarchical tests #938

Closed
@pesse

Description

@pesse

To make it easier to structure the tests (as described in this video by Kevlin Henney: https://www.youtube.com/watch?v=tWn8RA_DEic) 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
end;

Leading to

Queue Spec
  a_not_empty_queue
    that_is_not_full
      becomes_longer_when_non_null_value_enqueued [SUCCESS]
      becomes_full_when_enqueued_up_to_capacity [SUCCESS]
    that_is_full
      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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy