Bug 968575: Add unit tests for Debugger.Source.prototype.introductionType. r=djvj

This commit is contained in:
Jim Blandy 2014-02-07 12:40:54 -08:00
Родитель 0f605b207d
Коммит 0cbb20a62c
1 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,38 @@
// Check that scripts' introduction types are properly marked.
var g = newGlobal();
var dbg = new Debugger(g);
var log;
dbg.onDebuggerStatement = function (frame) {
log += 'd';
assertEq(frame.script.source.introductionType, 'eval');
};
log = '';
g.eval('debugger;');
assertEq(log, 'd');
dbg.onDebuggerStatement = function (frame) {
log += 'd';
assertEq(frame.script.source.introductionType, 'Function');
};
log = '';
g.Function('debugger;')();
assertEq(log, 'd');
dbg.onDebuggerStatement = function (frame) {
log += 'd';
assertEq(frame.script.source.introductionType, 'GeneratorFunction');
};
log = '';
g.eval('(function*() {})').constructor('debugger;')().next();
assertEq(log, 'd');
dbg.onDebuggerStatement = function (frame) {
log += 'd';
assertEq(frame.script.source.introductionType, undefined);
};
log = '';
g.evaluate('debugger;');
assertEq(log, 'd');