2012-12-19 06:16:40 +08:00
|
|
|
var assert = require('assert');
|
|
|
|
var tree = require('../lib/carto/tree.js');
|
|
|
|
require('../lib/carto/tree/quoted');
|
|
|
|
|
|
|
|
describe('Quoted', function() {
|
|
|
|
describe('basic functionality', function() {
|
|
|
|
it('should be constructed', function() {
|
2013-03-27 19:36:25 +08:00
|
|
|
var f = new tree.Quoted("Tom's & \"<quoted>\"");
|
2012-12-19 06:16:40 +08:00
|
|
|
assert.ok(f);
|
|
|
|
assert.equal(f.is, 'string');
|
|
|
|
});
|
|
|
|
it('should produce normal output', function() {
|
2013-03-27 19:36:25 +08:00
|
|
|
var f = new tree.Quoted("Tom's & \"<quoted>\"");
|
2012-12-19 06:16:40 +08:00
|
|
|
assert.ok(f);
|
2013-03-27 19:36:25 +08:00
|
|
|
assert.equal(f.toString(), "Tom's & \"<quoted>\"");
|
2012-12-19 06:16:40 +08:00
|
|
|
});
|
|
|
|
it('should produce xml-friendly output', function() {
|
2013-03-27 19:36:25 +08:00
|
|
|
var f = new tree.Quoted("Tom's & \"<quoted>\"");
|
2012-12-19 06:16:40 +08:00
|
|
|
assert.ok(f);
|
2013-03-27 19:36:25 +08:00
|
|
|
assert.equal(f.toString(true), "'Tom's & "<quoted>"'");
|
2012-12-19 06:16:40 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|