Skip to content

Commit

Permalink
Tests and bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Feb 20, 2024
1 parent c6d62bd commit 2a5f081
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions javascript/JZZ.midi.SMF.js
Expand Up @@ -15,7 +15,7 @@
/* istanbul ignore next */
if (JZZ.MIDI.SMF) return;

var _ver = '1.8.7';
var _ver = '1.8.8';

var _now = JZZ.lib.now;
function _error(s) { throw new Error(s); }
Expand Down Expand Up @@ -1436,7 +1436,7 @@
a = [];
if (s.length < off + len) {
for (i = off; i < s.length; i++) a.push(_hex(s.charCodeAt(i)));
this._complain(off, 'Incomplete message', a.join(' '));
clip._complain(off, 'Incomplete message', a.join(' '));
off += len;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion minified/JZZ.midi.SMF.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "jzz-midi-smf",
"version": "1.8.7",
"version": "1.8.8",
"description": "Standard MIDI Files: read / write / play (MIDI 1.0 and MIDI 2.0)",
"main": "javascript/JZZ.midi.SMF.js",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions test/mocha.js
Expand Up @@ -448,6 +448,14 @@ describe('SMF2', function() {
assert.throws(function() { clip.add(-1, JZZ.MIDI2.noop()); });
assert.throws(function() { clip.header.add(-1, JZZ.MIDI2.noop()); });
});
it('warnings', function() {
var clip = new JZZ.MIDI.Clip('abc' + (new RawClip()).dump() + "abc");
var val = clip.validate();
assert.equal(val[0].toString(), 'offset 3 -- Extra leading characters (3)');
assert.equal(val[1].toString(), 'offset 11 -- Incomplete message (61 62 63)');
assert.equal(val[2].toString(), 'offset 15 -- Missing Ticks PQN message');
assert.equal(val[3].toString(), 'offset 15 -- No Start of Clip message');
});
it('tick', function() {
var clip = new JZZ.MIDI.Clip();
clip.tick(96).umpDelta(96).tick(96).umpEndClip();
Expand Down

0 comments on commit 2a5f081

Please sign in to comment.