Skip to content

added tests for Create and Split Cascade Refactoring#19446

Open
jainoshika wants to merge 2 commits intopharo-project:Pharo14from
jainoshika:add-tests-for-cascade-refactoring
Open

added tests for Create and Split Cascade Refactoring#19446
jainoshika wants to merge 2 commits intopharo-project:Pharo14from
jainoshika:add-tests-for-cascade-refactoring

Conversation

@jainoshika
Copy link
Copy Markdown
Contributor

Tests are added for RBCreateCascadeRefactoring and RBSplitCascadeRefactoring in Refactoring-Transformations-Tests.

To broaden test coverage, some edge cases are explored with the help of an LLM. These tests were reviewed to ensure they are correct for the refactoring. If any changes do let me know.

Fixes #12533

Comment thread src/Refactoring-Transformations-Tests/RBCreateCascadeRefactoringTest.class.st Outdated
x := obj
bar;
baz.')
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the previous example is not really good.
I would expect

obj foo.
obj bar.
x := obj baz

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, that should be the expected behaviour. but i see the method implementation does not support complete flattening and assigning the last, rather it depends on where the cursor is placed.

Comment thread src/Refactoring-Transformations-Tests/RBSplitCascadeRefactoringTest.class.st Outdated
#package : 'Refactoring-Transformations-Tests',
#tag : 'Test'
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have the impression that the from: argument is not that great

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i changed it to #example currently. if you may share the reasons behind, i will try to think of more.

@Ducasse
Copy link
Copy Markdown
Member

Ducasse commented Mar 20, 2026

I have the impression that this refactoring is not fully specified.

@jainoshika
Copy link
Copy Markdown
Contributor Author

jainoshika commented Mar 20, 2026

I have the impression that this refactoring is not fully specified.

I agree, shall i go through the implementation first and check out the issues in it?

@jainoshika
Copy link
Copy Markdown
Contributor Author

I made changes in the splitCascade which now flattens cascade and returns last in Assignment.

But i am quite confused how the refactoring is supposed to work. the comment says that it divides in 2 parts so then,
will obj a; b; ^ c; d. return obj a;b. and obj c; d
But in case of assignment, we want the method to flatten the whole cascade like

obj a. 
obj b. 
obj c. 
x = obj d.

@Ducasse Ducasse requested a review from balsa-sarenac April 3, 2026 19:42
Copy link
Copy Markdown
Member

@balsa-sarenac balsa-sarenac left a comment

Choose a reason for hiding this comment

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

I think it's really good that we got these tests!
What I don't like is how split cascade works right now. For me, it has weird interface. We should discuss what would be a good interface.

I'd like to suggest we create a small UI that by default does best guess split, then you have small check boxes between message calls where you can check them to make those calls be cascade or not, so user ultimately picks what will be split and what isn't.

We can also rely on selection for splitting - example: all cascades in selection will be split, before or after it we preserve cascade. This might be harder since users don't know this and is not intuitive.

baz'.
self should: [ ref generateChanges ]
raise: RBRefactoringError.
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For me this would pass, I'd split after first message here, better UX too.

I'm not saying we should implement this in this PR.

baz'.
self should: [ ref generateChanges ]
raise: RBRefactoringError.
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd also expect this to do:

obj foo.
obj bar.
obj baz.

But this might only be me.
I'm not saying we should do this in this PR, we should discuss this.

@jainoshika
Copy link
Copy Markdown
Contributor Author

I'd like to suggest we create a small UI that by default does best guess split, then you have small check boxes between message calls where you can check them to make those calls be cascade or not, so user ultimately picks what will be split and what isn't.

I really like this idea, it will give the user more options and control.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for RBCreateCascasde and RBSplitCascade

3 participants