1/* 2 * Copyright (c) 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LLVM_LICENSE_HEADER@ 5 */ 6 7// 8// nestedimport.m 9// testObjects 10// 11// Created by Blaine Garst on 6/24/08. 12// Copyright 2008 Apple, Inc. All rights reserved. 13// 14// TEST_CONFIG 15 16#include <stdio.h> 17#include <stdlib.h> 18#include "test.h" 19 20int Global = 0; 21 22void callVoidVoid(void (^closure)(void)) { 23 closure(); 24} 25 26int main(int argc, char **argv __unused) { 27 int i = 1; 28 29 void (^vv)(void) = ^{ 30 if (argc > 0) { 31 callVoidVoid(^{ Global = i; }); 32 } 33 }; 34 35 i = 2; 36 vv(); 37 if (Global != 1) { 38 fail("Global not set to captured value"); 39 } 40 41 succeed(__FILE__); 42} 43