InputrcParser { protected static EditMode parseInputrc(InputStream inputStream) { return parseInputrc(inputStream, EditModeBuilder.builder()); }  static int[] mapKeys(String keys); static int[] mapQuoteKeys(String keys);  }
@Test public void testParseInputrc() throws IOException { EditMode editMode = InputrcParser.parseInputrc( new FileInputStream( Config.isOSPOSIXCompatible() ? new File("src/test/resources/inputrc1") : new File("src\\test\\resources\\inputrc1"))); assertEquals("vi", editMode.variableValue(Variable.EDITING_MODE)); assertEquals("visible", editMode.variableValue(Variable.BELL_STYLE)); assertEquals(300, Integer.parseInt(editMode.variableValue(Variable.HISTORY_SIZE))); assertEquals("on", editMode.variableValue(Variable.DISABLE_COMPLETION)); }
@Test public void testParseInputrc2() throws IOException { if(Config.isOSPOSIXCompatible()) { EditMode editMode = EditModeBuilder.builder().create(); ActionDecoder actionQueue = new ActionDecoder(); actionQueue.add(new int[]{27, 91, 68}); Assert.assertEquals("backward-char", editMode.parse( actionQueue.next()).name()); actionQueue.add(new int[]{27, 91, 66}); Assert.assertEquals("next-history", editMode.parse( actionQueue.next()).name()); actionQueue.add(1); Assert.assertEquals("beginning-of-line", editMode.parse( actionQueue.next()).name()); editMode = InputrcParser.parseInputrc( new FileInputStream( Config.isOSPOSIXCompatible() ? new File("src/test/resources/inputrc2") : new File("src\\test\\resources\\inputrc2"))); actionQueue.add(new int[]{27, 91, 68}); Assert.assertEquals("forward-char", editMode.parse( actionQueue.next()).name()); actionQueue.add(new int[]{27, 91, 66}); Assert.assertEquals("previous-history", editMode.parse(actionQueue.next()).name()); actionQueue.add(new int[]{27,10}); Assert.assertEquals("backward-char", editMode.parse(actionQueue.next()).name()); actionQueue.add(1); Assert.assertEquals("forward-word", editMode.parse(actionQueue.next()).name()); } }