public void GetKeyMappingResult_RemainderIsMappable() { var result = _map.GetKeyMappingResult("dog", KeyRemapMode.Normal).AsPartiallyMapped(); Assert.Equal(KeyInputSetUtil.OfString("d"), result.Item1); Assert.Equal(KeyInputSetUtil.OfString("og"), result.Item2); }
public void HandleLessThanEscapeLiteral() { Assert.True(_map.MapWithNoRemap("a", "<lt>lt>", KeyRemapMode.Normal)); var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal); Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().Item); }
public void HandleLessThanEscapeLiteral() { Assert.True(_map.AddKeyMapping("a", "<lt>lt>", allowRemap: false, KeyRemapMode.Normal)); var result = _map.Map("a", KeyRemapMode.Normal); Assert.Equal(KeyInputSetUtil.OfString("<lt>"), result.AsMapped().KeyInputSet); }
public void MapWithNoRemap_EscapeLessThanSymbol() { Assert.IsTrue(_map.MapWithNoRemap("a", @"\<Home>", KeyRemapMode.Normal)); var result = _map.GetKeyMappingResult("a", KeyRemapMode.Normal); Assert.AreEqual(KeyInputSetUtil.OfString("<Home>"), result.AsMapped().Item); }
protected void AssertMapping(KeyInputSet lhs, string expected, KeyRemapMode mode = null) { mode = mode ?? KeyRemapMode.Normal; var ret = _map.GetKeyMappingResult(lhs, mode); Assert.True(ret.IsMapped); Assert.Equal(KeyInputSetUtil.OfString(expected), ret.GetMappedKeyInputs()); }
public void Ambiguous_ResolveLonger() { Assert.True(_map.MapWithNoRemap("aa", "foo", KeyRemapMode.Normal)); Assert.True(_map.MapWithNoRemap("aaa", "bar", KeyRemapMode.Normal)); var ret = _map.GetKeyMappingResult("aaa", KeyRemapMode.Normal); Assert.True(ret.IsMapped); Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().Item); }
public void Ambiguous_ResolveLonger() { Assert.True(_map.AddKeyMapping("aa", "foo", allowRemap: false, KeyRemapMode.Normal)); Assert.True(_map.AddKeyMapping("aaa", "bar", allowRemap: false, KeyRemapMode.Normal)); var ret = _map.Map("aaa", KeyRemapMode.Normal); Assert.True(ret.IsMapped); Assert.Equal(KeyInputSetUtil.OfString("bar"), ret.AsMapped().KeyInputSet); }
protected void AssertPartialMapping(KeyInputSet lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null) { mode = mode ?? KeyRemapMode.Normal; var ret = _map.GetKeyMappingResult(lhs, mode); Assert.True(ret.IsPartiallyMapped); var partiallyMapped = ret.AsPartiallyMapped(); Assert.Equal(KeyInputSetUtil.OfString(expectedMapped), partiallyMapped.Item1); Assert.Equal(KeyInputSetUtil.OfString(expectedRemaining), partiallyMapped.Item2); }
protected static void AssertMany(string input, string result) { AssertMany(input, KeyInputSetUtil.OfString(result)); }
protected void AssertPartialMapping(string lhs, string expectedMapped, string expectedRemaining, KeyRemapMode mode = null) { AssertPartialMapping(KeyInputSetUtil.OfString(lhs), expectedMapped, expectedRemaining, mode); }