public void testPositionMigratorCompositionFailure() throws ComposeException {
{
// Simplified test case
// This tickles the path through ProcessingBForAInsert
DocOp a = builder.i("\n").b();
DocOp b = builder.rl(2).b();
DocOp expected = builder.i("\n").b();
assertCompose(expected, a, b);
}
{
// Simplified test case
// This tickles the path through ProcessingBForAInsert
DocOp a = builder.i("\n").b();
DocOp b = builder.rl(1).b();
DocOp expected = builder.i("\n").b();
assertCompose(expected, a, b);
}
{
// Simplified test case
// This tickles the path through ProcessingBForAInsert
DocOp a = builder.i("abc\n").i("def\n").b();
DocOp b = builder.d("a").eolR(3).rl(2).b();
DocOp expected = builder.i("bc\n").i("def\n").b();
assertCompose(expected, a, b);
}
{
// Simplified test case
// This tickles the path through ProcessingAForBRetainLine
DocOp a = builder.i("abc\n").i("def\n").b();
DocOp b = builder.rl(3).b();
DocOp expected = builder.i("abc\n").i("def\n").b();
assertCompose(expected, a, b);
}
{
// This should fail
DocOp a = builder.i("\n").b();
DocOp b = builder.rl(3).b();
assertComposeFails(a, b);
}
{
// This should fail
DocOp a = builder.i("\n").i("\n").b();
DocOp b = builder.rl(4).b();
assertComposeFails(a, b);
}
{
// Related test case
DocOp a = builder.i("abc\n").r(5).b();
DocOp b = builder.rl(2).b();
DocOp expected = builder.i("abc\n").r(5).b();
assertCompose(expected, a, b);
}
{
// Full test case
DocOp a = builder.d("var f = function() {\n").
d(" alert(\"foo!\");\n").
d("}\n").
d("\n").
d("f();\n").
i("d3.svg.diagonal = function() {\n").
i(" var source = d3_svg_chordSource,\n").
i(" target = d3_svg_chordTarget,\n").
i(" projection = d3_svg_diagonalProjection;\n").
i("\n").
i(" function diagonal(d, i) {\n").
i(" var p0 = source.call(this, d, i),\n").
i(" p3 = target.call(this, d, i),\n").
i(" m = (p0.y + p3.y) / 2,\n").
i(" p = [p0, {x: p0.x, y: m}, {x: p3.x, y: m}, p3];\n").
i(" p = p.map(projection);\n").
i(" return \"M\" + p[0] + \"C\" + p[1] + \" \" + p[2] + \" \" + p[3];\n").
i(" }\n").
i("\n").
i(" diagonal.source = function(x) {\n").
i(" if (!arguments.length) return source;\n").
i(" source = d3.functor(x);\n").
i(" return diagonal;\n").
i(" };\n").
i("\n").
i(" diagonal.target = function(x) {\n").
i(" if (!arguments.length) return target;\n").
i(" target = d3.functor(x);\n").
i(" return diagonal;\n").
i(" };\n").
i("\n").
i(" diagonal.projection = function(x) {\n").
i(" if (!arguments.length) return projection;\n").
i(" projection = x;\n").
i(" return diagonal;\n").
i(" };\n").
i("\n").
i(" return diagonal;\n").
i("};\n").b();
DocOp b = builder.d("d3.svg.").eolR(24).rl(34).b();
DocOpTestUtils.compose(a, b);
}
}