-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loop labels rename, completion, break and continue only inside loop
- Loading branch information
Showing
15 changed files
with
159 additions
and
28 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
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
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
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
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
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
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
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
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
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
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
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
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
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
67 changes: 67 additions & 0 deletions
67
src/test/kotlin/org/move/lang/completion/names/LoopCompletionTest.kt
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,67 @@ | ||
package org.move.lang.completion.names | ||
|
||
import org.move.utils.tests.completion.CompletionTestCase | ||
|
||
class LoopCompletionTest: CompletionTestCase() { | ||
fun `test no break keyword outside loop`() = checkNoCompletion(""" | ||
module 0x1::m { | ||
fun main() { | ||
bre/*caret*/ | ||
} | ||
} | ||
""") | ||
|
||
fun `test break keyword inside loop`() = doSingleCompletion(""" | ||
module 0x1::m { | ||
fun main() { | ||
loop { | ||
bre/*caret*/ | ||
} | ||
} | ||
} | ||
""", """ | ||
module 0x1::m { | ||
fun main() { | ||
loop { | ||
break /*caret*/ | ||
} | ||
} | ||
} | ||
""") | ||
|
||
fun `test complete loop label for break`() = doSingleCompletion(""" | ||
module 0x1::m { | ||
fun main() { | ||
'label: loop { | ||
break 'la/*caret*/; | ||
} | ||
} | ||
} | ||
""", """ | ||
module 0x1::m { | ||
fun main() { | ||
'label: loop { | ||
break 'label/*caret*/; | ||
} | ||
} | ||
} | ||
""") | ||
|
||
fun `test complete loop label for break from single quote`() = doSingleCompletion(""" | ||
module 0x1::m { | ||
fun main() { | ||
'label: loop { | ||
break '/*caret*/; | ||
} | ||
} | ||
} | ||
""", """ | ||
module 0x1::m { | ||
fun main() { | ||
'label: loop { | ||
break 'label/*caret*/; | ||
} | ||
} | ||
} | ||
""") | ||
} |