-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii-diff): renaming a positional argument is a breaking change i…
…n Python Related: #2927
- Loading branch information
1 parent
a63b2e8
commit a996fe6
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expectError } from './util'; | ||
|
||
// ---------------------------------------------------------------------- | ||
|
||
test.each([ | ||
['class', 'constructor'], | ||
['class', 'method'], | ||
['interface', 'method'], | ||
])( | ||
'not okay to rename a positional parameter', | ||
(scope, decl) => | ||
expectError( | ||
/positional parameter was renamed from 'previous' to 'current'/, | ||
// Note: name is ITest so we're good for both class & interface... Yes, this is ugly. | ||
` | ||
export ${scope} ITest { | ||
${decl}(previous: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { previous.use(); }' : ';'} | ||
}`, | ||
` | ||
export ${scope} ITest { | ||
${decl}(current: any)${decl === 'constructor' ? '' : ': void'}${scope === 'class' ? ' { current.use(); }' : ';'} | ||
}`, | ||
), | ||
); |