@Test
public void testVarIsRemovedButStructLeftBehind() throws Exception {

  final String original = "struct S { float x; } myS; void main() { gl_FragColor = vec4(S(3.0)"
      + ".x); }";
  final String expected = "struct S { float x; } ;    void main() { gl_FragColor = vec4(S(3.0)"
      + ".x); }";
  final TranslationUnit tu = ParseHelper.parse(original);
  final List<VariableDeclReductionOpportunity> ops = VariableDeclReductionOpportunities
      .findOpportunities(MakeShaderJobFromFragmentShader.make(tu),
          new ReducerContext(false, ShadingLanguageVersion.ESSL_100,
          new RandomWrapper(0), new IdGenerator()));
  assertEquals(1, ops.size());
  ops.get(0).applyReduction();
  CompareAsts.assertEqualAsts(expected, tu);
  final List<GlobalVariablesDeclarationReductionOpportunity> moreOps =
      GlobalVariablesDeclarationReductionOpportunities
      .findOpportunities(MakeShaderJobFromFragmentShader.make(tu),
          new ReducerContext(false, ShadingLanguageVersion.ESSL_100,
          new RandomWrapper(0), new IdGenerator()));
  assertEquals(0, moreOps.size());
}