-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Brian Oxley <boxley@thoughtworks.com>
- Loading branch information
Showing
4 changed files
with
87 additions
and
6 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
49 changes: 49 additions & 0 deletions
49
reader/src/test/java/org/jline/reader/LineReaderBuilderTest.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,49 @@ | ||
/* | ||
* Copyright (c) 20021, the original author or authors. | ||
* | ||
* This software is distributable under the BSD license. See the terms of the | ||
* BSD license in the documentation provided with this software. | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
package org.jline.reader; | ||
|
||
import org.jline.terminal.Terminal; | ||
import org.jline.terminal.TerminalBuilder; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class LineReaderBuilderTest { | ||
|
||
@Test | ||
public void testInheritAppNameFromTerminal() throws IOException { | ||
final String expectedAppName = "BOB"; | ||
final Terminal terminal = TerminalBuilder.builder() | ||
.name(expectedAppName) | ||
.build(); | ||
final LineReader lineReader = LineReaderBuilder.builder() | ||
.terminal(terminal) | ||
.build(); | ||
|
||
assertEquals("Did not inherit appName from terminal", | ||
expectedAppName, lineReader.getAppName()); | ||
} | ||
|
||
@Test | ||
public void testPreferAppNameFromBuilder() throws IOException { | ||
final String expectedAppName = "NANCY"; | ||
final Terminal terminal = TerminalBuilder.builder() | ||
.name(expectedAppName + "X") | ||
.build(); | ||
final LineReader lineReader = LineReaderBuilder.builder() | ||
.appName(expectedAppName) | ||
.terminal(terminal) | ||
.build(); | ||
|
||
assertEquals("Did not prefer appName from builder", | ||
expectedAppName, lineReader.getAppName()); | ||
} | ||
} |
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