Skip to content

Commit

Permalink
Tests for #882
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jul 8, 2015
1 parent 3cbe343 commit fcf365d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/compiler/functions/nested-closures.ooc
@@ -0,0 +1,29 @@

// cf. https://github.com/fasterthanlime/rock/issues/882

describe("nested closures should be able to modify outer variable by ref", ||
g := (1, 0) as Tuple
please(||
g = (2, 0) as Tuple
please(||
g = (3, 0) as Tuple
)
)
expect(3, g a)
)

describe("nested closures should not capture outer closure by ref by default", ||
g := (1, 0) as Tuple
please(||
g a = 2
)
expect(1, g a)
)

// support code

Tuple: cover {
a, b: Int
}

please: func (f: Func) { f() }

0 comments on commit fcf365d

Please sign in to comment.