Skip to content

Use of fullstop character in --%context(<name>) #966

Description

@BrianGubbins

Describe the bug

Using a full stop character in --%context(<name>) will cause all other contexts in the suite to be executed under an entirely different suite as seen in the output section below. The reason for this I believe is because the way a context name is interpreted as a path to allow users to execute specific contexts.

Version Info

utPLSQL: v3.1.6.2735
SQL Developer: 19.1.0.094

To Reproduce

1. Create tests

create or replace package test_context_bug_1 is

  --%suite

  --%context(suite_1 context_1)

    --%test
    procedure test1;

  --%endcontext
  
  --%context(suite_1 context_2)

    --%test
    procedure test2;

  --%endcontext

end;
/

create or replace package body test_context_bug_1 is

  procedure test1 is
  begin
    ut.expect( 1 ).to_equal( 1 );
  end;

  procedure test2 is
  begin
    ut.expect( 1 ).to_equal( 1 );
  end;

end;
/

create or replace package test_context_bug_2 is

  --%suite
  
  --%context(suite_2 context_1)
  
    --%test
    procedure test1;

  --%endcontext
  
  --%context(suite_2 context_2)

    --%test
    procedure test2;

  --%endcontext

end;
/

create or replace package body test_context_bug_2 is

  procedure test1 is
  begin
    ut.expect( 1 ).to_equal( 1 );
  end;

  procedure test2 is
  begin
    ut.expect( 1 ).to_equal( 1 );
  end;

end;
/

2. Add a full stop in a context name

--%context(suite_2. context_2)  

3. Run tests

SET SERVEROUTPUT ON SIZE UNLIMITED
EXECUTE ut.run(); 

Outputs

Expected output:

test_context_bug_1
  suite_1 context_2
    test2 [.003 sec]
  suite_1 context_1
    test1 [.002 sec]
 
test_context_bug_2
  suite_2 context_2
    test2 [.002 sec]
  suite_2 context_1
    test1 [.002 sec]
 
Finished in .013272 seconds
4 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)
PL/SQL procedure successfully completed.

Actual output:

test_context_bug_1
  suite_2 context_1
    test1 [.003 sec]
  suite_1 context_2
    test2 [.001 sec]
  suite_1 context_1
    test1 [.001 sec]
 
test_context_bug_2
  suite_2. context_2
    test2 [.003 sec]
 
Finished in .01466 seconds
4 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)
PL/SQL procedure successfully completed.

Expected behavior

When a full stop is present in --%context(<name>) the other contexts in the suite shouldn't be executed under another suite.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions