INNER CODE UNIT · Rust

parses_key_combos

keon/browser-control · src/actions.rs:301

    fn parses_key_combos() {
        assert_eq!(parse_key_combo("a").unwrap(), (0, "a".into()));
        assert_eq!(parse_key_combo("Enter").unwrap(), (0, "Enter".into()));
        assert_eq!(parse_key_combo("+").unwrap(), (0, "+".into()));
        assert_eq!(parse_key_combo("ctrl+a").unwrap(), (2, "a".into()));
        assert_eq!(parse_key_combo("cmd+shift+t").unwrap(), (12, "t".into()));
        assert_eq!(
            parse_key_combo("alt+ArrowLeft").unwrap(),
            (1, "ArrowLeft".into())
        );
        assert_eq!(parse_key_combo("ctrl++").unwrap(), (2, "+".into()));
        assert!(parse_key_combo("hyper+a").is_err());
    }

    #[test]
    fn maps_editing_commands() {
        assert_eq!(editing_command(2, "a"), Some("selectAll"));
        assert_eq!(editing_command(4, "A"), Some("selectAll"));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…