Skip to content

Commit

Permalink
Merge pull request #17 from tafia/testVBA
Browse files Browse the repository at this point in the history
Add test for reading vba
  • Loading branch information
tafia committed Oct 24, 2016
2 parents 410d816 + bade06c commit 741d876
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,18 @@ fn issue_9() {
assert_eq!(r.next(), Some(&[String("test4".to_string())] as &[DataType]));
assert_eq!(r.next(), None);
}

#[test]
fn vba() {
let path = format!("{}/tests/vba.xlsm", env!("CARGO_MANIFEST_DIR"));
let mut excel = Excel::open(&path).expect("cannot open excel file");

let vba = excel.vba_project().unwrap();
let modules = vba.read_vba().unwrap().1;
let test_vba = modules.into_iter().find(|m| &*m.name == "testVBA").unwrap();
assert_eq!(vba.read_module(&test_vba).unwrap(), "Attribute VB_Name = \"testVBA\"\
\r\nPublic Sub test()\
\r\n MsgBox \"Hello from vba!\"\
\r\nEnd Sub\
\r\n");
}
Binary file added tests/vba.xlsm
Binary file not shown.

0 comments on commit 741d876

Please sign in to comment.