|
| 1 | +var fullProject = require('./fixtures/full-project') |
| 2 | + fullProjectStr = JSON.stringify(fullProject), |
| 3 | + pbx = require('../lib/pbxProject'), |
| 4 | + pbxFile = require('../lib/pbxFile'), |
| 5 | + proj = new pbx('.'); |
| 6 | + |
| 7 | +function cleanHash() { |
| 8 | + return JSON.parse(fullProjectStr); |
| 9 | +} |
| 10 | + |
| 11 | +exports.setUp = function (callback) { |
| 12 | + proj.hash = cleanHash(); |
| 13 | + callback(); |
| 14 | +} |
| 15 | + |
| 16 | +var PRODUCT_NAME = '"KitchenSinktablet"'; |
| 17 | + |
| 18 | +exports.addAndRemoveToFromLibrarySearchPaths = { |
| 19 | + 'add should add the path to each configuration section':function(test) { |
| 20 | + proj.addToLibrarySearchPaths({ |
| 21 | + path:'some/path/poop.a' |
| 22 | + }); |
| 23 | + var config = proj.pbxXCBuildConfigurationSection(); |
| 24 | + for (var ref in config) { |
| 25 | + if (ref.indexOf('_comment') > -1 || config[ref].buildSettings.PRODUCT_NAME != PRODUCT_NAME) continue; |
| 26 | + var lib = config[ref].buildSettings.LIBRARY_SEARCH_PATHS; |
| 27 | + test.ok(lib[1].indexOf('$(SRCROOT)/KitchenSinktablet/some/path') > -1); |
| 28 | + } |
| 29 | + test.done(); |
| 30 | + }, |
| 31 | + 'remove should remove from the path to each configuration section':function(test) { |
| 32 | + var libPath = 'some/path/poop.a'; |
| 33 | + proj.addToLibrarySearchPaths({ |
| 34 | + path:libPath |
| 35 | + }); |
| 36 | + proj.removeFromLibrarySearchPaths({ |
| 37 | + path:libPath |
| 38 | + }); |
| 39 | + var config = proj.pbxXCBuildConfigurationSection(); |
| 40 | + for (var ref in config) { |
| 41 | + if (ref.indexOf('_comment') > -1 || config[ref].buildSettings.PRODUCT_NAME != PRODUCT_NAME) continue; |
| 42 | + var lib = config[ref].buildSettings.LIBRARY_SEARCH_PATHS; |
| 43 | + test.ok(lib.length === 1); |
| 44 | + test.ok(lib[0].indexOf('$(SRCROOT)/KitchenSinktablet/some/path') == -1); |
| 45 | + } |
| 46 | + test.done(); |
| 47 | + } |
| 48 | +} |
0 commit comments