@Test
public void testRemoveNonVoidReturn() throws Exception {

  // Both return statements are candidates for removal, but removing one disables removing the
  // other.
  final String program = "int foo() { return 1; return 0; }";
  final String expected = "int foo() { return 0; }";
  final TranslationUnit tu = ParseHelper.parse(program);
  final ReducerContext context = new ReducerContext(true, ShadingLanguageVersion.ESSL_300,
      new RandomWrapper(0), new IdGenerator());
  final ShaderJob shaderJob = MakeShaderJobFromFragmentShader.make(tu);
  List<StmtReductionOpportunity> ops = StmtReductionOpportunities.findOpportunities(
      shaderJob,
      context);
  assertEquals(2, ops.size());
  ops.get(0).applyReduction();
  CompareAsts.assertEqualAsts(expected, tu);
  assertFalse(ops.get(1).preconditionHolds());
  ops = StmtReductionOpportunities.findOpportunities(
      shaderJob,
      context);
  assertTrue(ops.isEmpty());
}