📄 stringoperationtest.groovy
字号:
class StringOperationTest extends GroovyTestCase { def x def y void testPlus() { x = "hello " + "there" assert x == "hello there" x = "hello " + 2 assert x == "hello 2" x = "hello " + 1.2 assert x == "hello 1.2" y = x + 1 assert y == "hello 1.21" } void testLongPlus() { x = "hello" + " " + "there" + " nice" + " day" assert x == "hello there nice day" } void testMinus() { x = "the quick brown fox" - "quick " assert x == "the brown fox" y = x - "brown " assert y == "the fox" } void testOperationsOnConstantString() { assert "hello".size() == 5 assert "the quick brown".substring(4).substring(0,5) == "quick" }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -