UNPKG

pbxproj

Version:

parse & stringify xcode pbxproj format

60 lines (45 loc) 1.54 kB
var _ = require('lodash'); var assert = require('assert'); var ArrayStage = require('../lib/stage/array'); describe('ArrayStage', function () { it('should call expectedError when first caracter is not "("', function (done) { var ctx = {}; var stage = new ArrayStage(ctx, '{', 0, 0); stage.expectedError = _.partial(done, null); stage.run(); }); it('should call open when first caracter is "("', function (done) { var ctx = {}; var stage = new ArrayStage(ctx, '(', 0, 0); stage.expectedError = _.noop; stage.open = _.partial(done, null); stage.run(); }); it('should call beginClose when ")" is found', function (done) { var ctx = {}; var stage = new ArrayStage(ctx, '()', 0, 0); stage.expectedError = _.noop; stage.beginClose = _.partial(done, null); stage.run(); }); it('should call expectedError when ")" is found but no ";"', function (done) { var ctx = {}; var stage = new ArrayStage(ctx, '()', 0, 0); stage.expectedError = _.partial(done, null); stage.run(); }); it('should call endClose when array is correctly closed', function (done) { var ctx = {}; var stage = new ArrayStage(ctx, '();', 0, 0); stage.endClose = _.partial(done, null); stage.run(); }); it('should feed the ctx object', function (done) { var ctx = []; var stage = new ArrayStage(ctx, '(foo;bar;);', 0, 0, function () { assert.deepEqual(['foo', 'bar'], ctx); done(); }); stage.run(); }); });