diff options
| author | Teddy Wing | 2018-08-26 09:27:00 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2018-08-26 09:27:00 +0200 | 
| commit | f9f50f67005617e352eff23468b5798f3c0d647c (patch) | |
| tree | 17560a90d9b95abe155d2a8bade5131c287e8380 | |
| parent | 47efec1164a5cb4b93161b3fedd999401b190e80 (diff) | |
| download | dome-key-map-f9f50f67005617e352eff23468b5798f3c0d647c.tar.bz2 | |
cocoa_bridge(run_key_action): Add newline to end of test map group
I keep forgetting to add the newline at the end, darn. Wasted a few
minutes of my time, but so cool that it's finally working now! The C
program now correctly prints the corresponding map.
Here's a diff of print debug statements I used to diagnose the problem:
    diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
    index fe65533..9690fe4 100644
    --- a/src/cocoa_bridge.rs
    +++ b/src/cocoa_bridge.rs
    @@ -68,12 +68,14 @@ pub extern "C" fn c_run_key_action(
             Some(k) => {
                 match k.action {
                     Some(a) => {
    +                    println!("all good");
                         CKeyActionResult {
                             action: a.as_ptr(),
                             kind: &k.kind,
                         }
                     },
                     None => {
    +                    println!("Action null");
                         CKeyActionResult {
                             action: ptr::null(),
                             kind: &k.kind,
    @@ -82,6 +84,7 @@ pub extern "C" fn c_run_key_action(
                 }
             },
             None => {
    +            println!("All null");
                 CKeyActionResult {
                     action: ptr::null(),
                     kind: ptr::null(),
    @@ -98,11 +101,17 @@ pub extern "C" fn run_key_action(
     ) -> Option<KeyActionResult> {
         let sample_maps = "map <up> k
     map <down> j
    -map <play><down> works!";
    +map <play><down> works!
    +";
    +
    +    println!("{:?}", trigger);
    +    assert!(trigger == &[HeadphoneButton::Play, HeadphoneButton::Down]);
         // Figure out how to persist this without re-parsing
         let map_group = MapGroup::parse(sample_maps).unwrap();
    +    println!("{:?}", map_group.maps);
    +
         let map = map_group.maps.get(trigger);
         let mode = map_group.modes.get(trigger);
| -rw-r--r-- | src/cocoa_bridge.rs | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index fe65533..1f0b693 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -98,7 +98,8 @@ pub extern "C" fn run_key_action(  ) -> Option<KeyActionResult> {      let sample_maps = "map <up> k  map <down> j -map <play><down> works!"; +map <play><down> works! +";      // Figure out how to persist this without re-parsing      let map_group = MapGroup::parse(sample_maps).unwrap(); | 
