@Test
public void checkForVariableInScope2() throws Exception {

  final String program = ""
        + "struct _GLF_struct_1 {\n"
        + "  float dist;\n"
        + "};\n"
        + "void main() {\n"
        + "  int dist;\n"
        + "  {\n"
        + "    _GLF_struct_1 _GLF_struct_replacement_2 = _GLF_struct_1(1.0);\n"
        + "  }\n"
        + "}\n";
  final String expected = ""
        + "struct _GLF_struct_1 {\n"
        + "  float dist;\n"
        + "};\n"
        + "void main() {\n"
        + "  int dist;\n"
        + "  {\n"
        + "    float dist = 1.0;\n"
        + "  }\n"
        + "}\n";
  final TranslationUnit tu = ParseHelper.parse(program);
  final List<DestructifyReductionOpportunity> ops = DestructifyReductionOpportunities
      .findOpportunities(MakeShaderJobFromFragmentShader.make(tu),
        new ReducerContext(false,
        ShadingLanguageVersion.ESSL_100, new RandomWrapper(0), new IdGenerator()));
  // There should be one opportunity as variable dist is in a different scope and not used in this
  // scope.
  assertEquals(1, ops.size());
  ops.get(0).applyReduction();
  assertEquals(PrettyPrinterVisitor.prettyPrintAsString(ParseHelper.parse(expected)),
        PrettyPrinterVisitor.prettyPrintAsString(tu));
}