Skip to content

Commit

Permalink
Se pueden mezclar los 3 flags distintos
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavarria committed Oct 7, 2011
1 parent ee32c24 commit 0b488b0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions rchavarria/src/test/java/es/rchavarria/kataargs/ArgsTest.groovy
Expand Up @@ -84,21 +84,6 @@ class ArgsTest {
assert -5 == args.getValueOfFlag("j")
}

@Test
public void testIntegerAndBooleanFlags() {
def schema = "iI,bB,jI,cB"
def argList = ["-i", "5", "-b"]
Args args = new Args(schema, argList)

assert "i" == args.nextFlag()
assert 5 == args.getValueOfFlag("i")
assert "b" == args.nextFlag()
assert true == args.getValueOfFlag("b")

assert 0 == args.getValueOfFlag("j")
assert false == args.getValueOfFlag("c")
}

@Test
public void testOneFlagString() {
def schema = "sS"
Expand All @@ -108,4 +93,22 @@ class ArgsTest {
assert "s" == args.nextFlag()
assert "this-is-a-string" == args.getValueOfFlag("s")
}

@Test
public void testDifferentFlags() {
def schema = "iI,bB,jI,cB,sS,tS"
def argList = ["-i", "5", "-b", "-s", "this-is-a-string"]
Args args = new Args(schema, argList)

assert "i" == args.nextFlag()
assert 5 == args.getValueOfFlag("i")
assert "b" == args.nextFlag()
assert true == args.getValueOfFlag("b")
assert "s" == args.nextFlag()
assert "this-is-a-string" == args.getValueOfFlag("s")

assert false == args.getValueOfFlag("c")
assert 0 == args.getValueOfFlag("j")
assert "" == args.getValueOfFlag("t")
}
}

0 comments on commit 0b488b0

Please sign in to comment.