You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
531 B

import groovy.util.GroovyTestCase
import static org.wikimedia.integration.Utility.*
class UtilityTestCase extends GroovyTestCase {
void testArg() {
assert arg("foo bar'\n baz") == """'foo bar'\\''\n baz'"""
}
void testArgs() {
assert args(["foo bar'\n baz", "qux"]) == """'foo bar'\\''\n baz' 'qux'"""
}
void testRandomAlphanum() {
def expectedChars = ('a'..'z') + ('0'..'9')
def alphanum = randomAlphanum(12)
assert alphanum.length() == 12
alphanum.each { assert it in expectedChars }
}
}