-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-1009: SetPlugin now removes variable if no value is provided
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
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
38 changes: 38 additions & 0 deletions
38
shell/src/test/java/org/jboss/forge/shell/plugins/builtin/SetPluginTest.java
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,38 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.shell.plugins.builtin; | ||
|
||
import org.jboss.forge.test.AbstractShellTest; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class SetPluginTest extends AbstractShellTest | ||
{ | ||
|
||
@Test | ||
public void testSetProperty() throws Exception | ||
{ | ||
getShell().execute("set"); | ||
Assert.assertFalse(getOutput().contains("ABC=avalue")); | ||
getShell().execute("set ABC avalue"); | ||
getShell().execute("set"); | ||
Assert.assertTrue(getOutput().contains("ABC=avalue")); | ||
} | ||
|
||
@Test | ||
public void testRemoveProperty() throws Exception | ||
{ | ||
getShell().execute("set ABC avalue"); | ||
getShell().execute("set"); | ||
Assert.assertTrue(getOutput().contains("ABC=avalue")); | ||
resetOutput(); | ||
getShell().execute("set ABC"); | ||
getShell().execute("set"); | ||
Assert.assertFalse(getOutput().contains("ABC=avalue")); | ||
} | ||
} |