8000 Changed ordering of tests for suites with context by jgebal · Pull Request #1037 · utPLSQL/utPLSQL · GitHub
[go: up one dir, main page]

Skip to content

Changed ordering of tests for suites with context #1037

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

Merged
merged 3 commits into from
Jan 4, 2020

Conversation

jgebal
Copy link
Member
@jgebal jgebal commented Dec 29, 2019

Resolves #1036

@jgebal jgebal added this to the 3.1.10 milestone Dec 29, 2019
@jgebal jgebal added the bugfix label Dec 29, 2019
@jgebal jgebal requested a review from pesse December 29, 2019 01:01
Copy link
Member
@pesse pesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test OK.
Tested on local develop-environment with APP-user on ut3. Changes in position of --%context and --%test annotations are correctly reflected in the output.
Test-package used:

create or replace package ut_context_test as

  -- %suite(Context Test)
  -- %suitepath(context)


  -- %context(Level 2)
    --%name(proj_same)

    -- %test(Test 2.1 )
    procedure test_2_1;

  -- %endcontext

  -- %context(Level 1)
    --%name(proj_diff)

    -- %context(Level 1.1)

      -- %test(Test 1.1.2)
      procedure test_1_1_2;
      -- %test(Test 1.1.1)
      procedure test_1_1_1;

    -- %endcontext

  -- %endcontext

end;
/

case when c.obj.self_type = 'UT_SUITE_CONTEXT' then
( select max( x.line_no ) + 1
from ut_suite_cache x
where c.obj.object_owner = x.object_owner and c.obj.object_name = x.object_name and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligning the multiple criteria would improve readability, or?

where c.obj.object_owner = x.boject_owner
   and c.obj.object_name = x.object_name
   and x.path like c.obj.path || '.%'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

then substr(c.obj.path, 1, instr(c.obj.path, '.', -1) )
else c.obj.path
end, '.', chr(0)
substr( c.obj.path, 1, instr( c.obj.path, lower(c.obj.object_name), -1 ) + length(c.obj.object_name) ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this very hard to read/understand. I guess extracting to a helper function would be too much overhead - can we add a comment to explain the intention?
-- get path until object's name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is documented properly now.
Thanks for this comment. It helps me a lot to see what is not obvious/clear.

@jgebal jgebal force-pushed the feature/test_ordering branch from 234be36 to 1da8720 Compare January 3, 2020 05:34
@jgebal jgebal force-pushed the feature/test_ordering branch from 1da8720 to 326e055 Compare January 3, 2020 05:37
@jgebal
Copy link
Member Author
jgebal commented Jan 4, 2020

@pesse - Can you review and check if you're OK with the changes after requested fixes?

@jgebal jgebal merged commit d9077a1 into develop Jan 4, 2020
@jgebal jgebal deleted the feature/test_ordering branch January 4, 2020 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd default ordering of tests when using contexts
2 participants
0