1. Kink Programming Language
  2. Untitled project
  3. kink

Commits

Taku Miyakawa  committed f9acf17

The new nomenclature on issue test module names (closing issue #455)

  • Participants
  • Parent commits 940b33b
  • Branches default

Comments (0)

Files changed (136)

File src/test/kink/issue/ISSUE_0006.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue 6
+# http://code.google.com/p/kink-lang/issues/detail?id=6
+# Make a method LIST.flat
+
+test {
+    [ [ 1  2 ]  []  [ 3  [ 4 ]  5 ]  6 ].flat.check( [ 1  2  3  4  5  6 ] )
+}
+
+test {
+    [].flat.check( [] )
+}

File src/test/kink/issue/ISSUE_0008.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #8
+# http://code.google.com/p/kink-lang/issues/detail?id=8
+test {
+    :Iter = 10.to(15)
+    Iter.list.check([10 11 12 13 14 15])
+}
+
+test {
+    :Iter = 10.to(10)
+    Iter.list.check([10])
+}
+
+test {
+    :Iter = 10.to(-1)
+    Iter.list.check([])
+}
+
+test {
+    :Iter = 10.to(-100)
+    Iter.list.check([])
+}

File src/test/kink/issue/ISSUE_0009.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+use('COMMON_PATTERN.object')
+
+# Tests issue 9
+# http://code.google.com/p/kink-lang/issues/detail?id=9
+test {
+    use('java.math.BigInteger')
+    :Num = 100
+    Num.cancast?(BigInteger).check(true)
+    :Bignum = Num.exact(BigInteger)
+    Bignum.check(object(BigInteger))
+    Bignum.check(BigInteger.valueOf(100))
+}

File src/test/kink/issue/ISSUE_0010.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('USING.using')
+use('TEST.test')
+
+# Tests issue #10
+# http://code.google.com/p/kink-lang/issues/detail?id=10
+test {
+    use('java.lang.System')
+    use('java.util.UUID')
+    :Work_dir = path(expand('#{System.getProperty("java.io.tmpdir")}/kink-#{UUID.randomUUID}'))
+    Work_dir.mkdir
+
+    :File = Work_dir + 'file.txt'
+    File.print("foo\nbar\nbaz\n")
+    using(File.in) { (:Reader)
+        Reader.lineseq.list.check(["foo\n" "bar\n" "baz\n"])
+    }
+
+    Work_dir.rmr
+}

File src/test/kink/issue/ISSUE_0011.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+use('COMMON_PATTERN.not')
+
+# Tests issue #11
+# http://code.google.com/p/kink-lang/issues/detail?id=11
+
+test {
+    # U+307b U+3052 represents 'Ho Ge' in Hiragana
+    :Hoge = "\u307b\u3052"
+
+    # Should not escape Hiragana
+    Hoge.show.check(not('"\u307b\u3052"'))
+
+    # Should return Hiragana themselves
+    Hoge.show.check("'" + Hoge + "'")
+}
+
+test {
+    # Ascii control characters are escaped
+    "\u0001".show.check('"\u0001"')
+    "\u007f".show.check('"\u007f"')
+}

File src/test/kink/issue/ISSUE_0012.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #12
+# http://code.google.com/p/kink-lang/issues/detail?id=12
+
+:Char = "\u0001"
+
+test {
+    Char.show.check( '"\u0001"' )
+}
+
+test {
+    eval(Char.show).check(Char)
+}

File src/test/kink/issue/ISSUE_0021.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #21
+# http://code.google.com/p/kink-lang/issues/detail?id=21
+
+test {
+    # '(' not after linefeed characters is open paren for parameters
+    :repeat = { (:T)
+        T + T
+    }
+    repeat('foo').check('foofoo')
+}
+
+test {
+    # '(' after linefeed characters is open paren to enclose an expression
+    :text = {
+        ('foo' + 'bar') * 2
+    }
+    text.check('foobarfoobar')
+}
+
+test {
+    # '(' after linefeed characters is open paren to enclose an expression
+    :foobarfoobar = {
+        :Foo = '  foo  '.trim
+        (Foo + 'bar') * 2
+    }
+    foobarfoobar.check('foobarfoobar')
+}
+
+test {
+    # '{' after linefeed characters is an open brace for a function literal
+    :initial = { 10 }
+    :facto = {
+        :Result = 1
+        :N = initial
+        { N != 0 }.loop {
+            :Result.solid = Result * N
+            :N.solid = N - 1
+        }
+        Result
+    }
+    facto.check(10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1)
+}

File src/test/kink/issue/ISSUE_0025.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue 25
+# http://code.google.com/p/kink-lang/issues/detail?id=25
+
+# Matcher
+
+test {
+    :Matcher = %'[a-zA-Z][a-zA-Z0-9?_]*'.matcher('MORE_LINES?')
+    Matcher.matches.check(true)
+}
+
+test {
+    :Matcher = 'MORE_LINES?'.matcher('MORE_LINES?')
+    Matcher.matches.check(true)
+}
+
+# Substitution for matcher
+
+test {
+    :Matcher = %'(x)'.matcher('fooxbarxbaz')
+    Matcher.find
+    'X'.replacement(Matcher).check('X')
+}
+
+test {
+    :Matcher = %'(x)'.matcher('fooxbarxbaz')
+    Matcher.find
+    { 'X' } .replacement(Matcher).check('X')
+}
+
+test {
+    :Matcher = %'[a-z]+'.matcher('foo bar')
+    Matcher.find
+    { (:Match) -> Match.group * 2 } .replacement(Matcher).check('foofoo')
+}
+
+# divide
+
+test {
+    ('AB:::CD::::EF' / '::').check(['AB' ':CD' '' 'EF'])
+}
+
+test {
+    ('abc' / '').check(['' 'a' 'b' 'c' ''])
+}

File src/test/kink/issue/ISSUE_0029.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #29
+# http://code.google.com/p/kink-lang/issues/detail?id=29
+
+test {
+    :empty_traces = $traces.notrace
+    empty_traces.check( [] )
+}

File src/test/kink/issue/ISSUE_0034.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #34
+# http://code.google.com/p/kink-lang/issues/detail?id=34
+
+test {
+    :assert = { (:True :Fourtytwo)
+        True.check(true)
+        Fourtytwo.check(42)
+    }
+    assert(true (21 * 2))
+}
+
+test {
+    :dont_take_arguments = {
+        (:Val = 42)
+        Val.check(42)
+        \0.check('arg')
+    }
+    dont_take_arguments('arg')
+}

File src/test/kink/issue/ISSUE_0036.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# Issue 36:
+# Access to prototype values
+# http://code.google.com/p/kink-lang/issues/detail?id=36
+
+use('TEST.test')
+use('COMMON_PATTERN.sub')
+
+test {
+    use('java.lang.String')
+    'twift'.check(sub(String.prototype))
+}

File src/test/kink/issue/ISSUE_0040.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #40
+# http://code.google.com/p/kink-lang/issues/detail?id=40
+
+test {
+    :N = 42
+    expand('N = #N').check('N = 42')
+    expand("N:\n\t#N").check("N:\n\t42")
+}

File src/test/kink/issue/ISSUE_0041.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue 41
+# http://code.google.com/p/kink-lang/issues/detail?id=41
+
+test {
+    :List = [10 20 30]
+    expand('sum=#{ List.fold(0) { \0 + \1 } }').check('sum=60')
+}
+
+test {
+    :List = [10 20 30]
+    expand('sum=#{ :calc = { List.fold(0) { \0 + \1 } } calc }').check('sum=60')
+}

File src/test/kink/issue/ISSUE_0045.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #45
+# http://code.google.com/p/kink-lang/issues/detail?id=45
+
+test {
+    10.op_pow( 3 ).check( 10 * 10 * 10 )
+}
+
+test {
+    0.op_pow( 0 ).check( 1 )
+}
+
+test {
+    4.op_pow( 0.5 ).check( 2 )
+}
+
+test {
+    eval( '10 ** 3' ).check( 10 * 10 * 10 )
+}
+
+test {
+    eval( '0 ** 0' ).check( 1 )
+}
+
+test {
+    eval( '4 ** 0.5' ).check( 2 )
+}
+
+test {
+    eval( '42 ** 100 ** 0' ).check( 42 )
+}

File src/test/kink/issue/ISSUE_0046.kn

View file
  • Ignore whitespace
+#! kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #46
+# http://code.google.com/p/kink-lang/issues/detail?id=46
+
+test {
+    ( 10 ** -1 ).check( 0.1 )
+}
+
+test {
+    ( 1 ** -1 ).check( 1 )
+}
+
+test {
+    ( 1 ** 0 ).check( 1 )
+}
+
+test {
+    ( 1 ** 999999999 ).check( 1 )
+}
+
+test {
+    ( 1 ** 1000000000 ).check( 1 )
+}
+
+test {
+    use( 'java.lang.Integer' )
+    ( 1 ** Integer.MIN_VALUE ).check( 1 )
+}

File src/test/kink/issue/ISSUE_0051.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #51
+# http://code.google.com/p/kink-lang/issues/detail?id=51
+
+test {
+    41.4.floor.check( 41 )
+    41.5.floor.check( 41 )
+    42.floor.check( 42 )
+    42.4.floor.check( 42 )
+    42.5.floor.check( 42 )
+}
+
+test {
+    ( - 41.4 ).floor.check( - 42 )
+    ( - 41.5 ).floor.check( - 42 )
+    ( - 42 ).floor.check( - 42 )
+    ( - 42.4 ).floor.check( - 43 )
+    ( - 42.5 ).floor.check( - 43 )
+}
+
+test {
+    41.4.ceil.check( 42 )
+    41.5.ceil.check( 42 )
+    42.ceil.check( 42 )
+    42.4.ceil.check( 43 )
+    42.5.ceil.check( 43 )
+}
+
+test {
+    ( - 41.4 ).ceil.check( - 41 )
+    ( - 41.5 ).ceil.check( - 41 )
+    ( - 42 ).ceil.check( - 42 )
+    ( - 42.4 ).ceil.check( - 42 )
+    ( - 42.5 ).ceil.check( - 42 )
+}
+
+test {
+    41.4.round.check( 41 )
+    41.5.round.check( 42 )
+    42.round.check( 42 )
+    42.4.round.check( 42 )
+    42.5.round.check( 43 )
+}
+
+test {
+    ( - 41.4 ).round.check( - 41 )
+    ( - 41.5 ).round.check( - 41 )
+    ( - 42 ).round.check( - 42 )
+    ( - 42.4 ).round.check( - 42 )
+    ( - 42.5 ).round.check( - 42 )
+}

File src/test/kink/issue/ISSUE_0052.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #52
+# http://code.google.com/p/kink-lang/issues/detail?id=52
+
+test {
+    eval('
+        :Num = - 3.14
+        Num
+    ').check(0 - 3.14)
+}
+
+test {
+    eval('[-10 (-5) 0 5 10]').check([(0 - 10) (0 - 5) 0 5 10])
+}
+
+test {
+    use('COMMON_PATTERN.eq')
+    :List = eval('[(-5) 10 (-15)]')
+    eval(List.show).check(eq(List))
+}

File src/test/kink/issue/ISSUE_0057.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #57
+# http://code.google.com/p/kink-lang/issues/detail?id=57
+
+test {
+    [ 10  20  30 ].any? { \0 == 20 }.check( true )
+    [ 10  20  30 ].any? { \0 == 42 }.check( false )
+}
+
+test {
+    [ 10  20  30 ].seq.any? { \0 == 20 }.check( true )
+    [ 10  20  30 ].seq.any? { \0 == 42 }.check( false )
+}
+
+test {
+    'foobar'.any?( 'ob' ).check( true )
+    'foobar'.any?( 'xxx' ).check( false )
+}
+
+test {
+    use('MAP')
+    MAP.map('foo' 'FOO'  'bar' 'BAR').any?.check( true )
+    MAP.map().any?.check( false )
+}

File src/test/kink/issue/ISSUE_0061.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #61
+# http://code.google.com/p/kink-lang/issues/detail?id=61
+
+test {
+    :List = [['foo' 'bar'] ['baz'] [] ['qux' 'xyzzy']]
+    List.concat.check(['foo' 'bar' 'baz' 'qux' 'xyzzy'])
+}

File src/test/kink/issue/ISSUE_0062.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #62
+# http://code.google.com/p/kink-lang/issues/detail?id=62
+
+test {
+    :List = [100 200 300 400 500]
+    List.concatmap { [\0 \0 + 1] } .check([
+        100 101 200 201 300 301 400 401 500 501
+    ])
+}

File src/test/kink/issue/ISSUE_0063.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #63
+# http://code.google.com/p/kink-lang/issues/detail?id=63
+
+use('java.io.ByteArrayInputStream')
+
+test {
+    :In = ByteArrayInputStream.new( "foo\nbar\r\nbaz".bytes( 'UTF-8' ) )
+    In.line( 'UTF-8' ).check( "foo\n" )
+    In.line( 'UTF-8' ).check( "bar\r\n" )
+    In.line( 'UTF-8' ).check( "baz" )
+    In.line( 'UTF-8' ).check( "" )
+    In.line( 'UTF-8' ).check( "" )
+}
+
+test {
+    :In = ByteArrayInputStream.new( "foo\nbar\r\nbaz".bytes( 'UTF-8' ) )
+    In.lines.check( [ "foo\n"  "bar\r\n"  "baz" ] )
+}
+
+test {
+    :In = ByteArrayInputStream.new( "foo\nbar\r\nbaz".bytes( 'UTF-8' ) )
+    In.lineseq.list.check( [ "foo\n"  "bar\r\n"  "baz" ] )
+}
+
+test {
+    "foo\nbar\r\nbaz".lines.check( [ "foo\n"  "bar\r\n"  "baz" ] )
+}

File src/test/kink/issue/ISSUE_0064.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #64
+# http://code.google.com/p/kink-lang/issues/detail?id=64
+
+test {
+    :Value = value.tee {
+        \0.:foo = { 'FOO' }
+        \0.:bar = { 'BAR' }
+    }
+    Value.foo.check( 'FOO' )
+    Value.bar.check( 'BAR' )
+}

File src/test/kink/issue/ISSUE_0067.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #67
+# http://code.google.com/p/kink-lang/issues/detail?id=66
+
+test {
+    :List = ['foo' 'BAR' 'baz' 'QUX' 'acme']
+    List.first.check('foo')
+}
+
+test {
+    :List = ['foo' 'BAR' 'baz' 'QUX' 'acme']
+    List.first(%'[A-Z]+').check('BAR')
+}
+
+test {
+    :List = ['foo' 'BAR' 'baz' 'QUX' 'acme']
+    List.last.check('acme')
+}
+
+test {
+    :List = ['foo' 'BAR' 'baz' 'QUX' 'acme']
+    List.last(%'[A-Z]+').check('QUX')
+}
+
+test {
+    :Seq = ['foo' 'BAR' 'baz' 'QUX' 'acme'].seq
+    Seq.first.check('foo')
+}
+
+test {
+    :Seq = ['foo' 'BAR' 'baz' 'QUX' 'acme'].seq
+    Seq.first(%'[A-Z]+').check('BAR')
+}
+
+test {
+    :Seq = ['foo' 'BAR' 'baz' 'QUX' 'acme'].seq
+    Seq.last.check('acme')
+}
+
+test {
+    :Seq = ['foo' 'BAR' 'baz' 'QUX' 'acme'].seq
+    Seq.last(%'[A-Z]+').check('QUX')
+}
+
+test {
+    '>foo    bar<'.first.check('>')
+    '>foo    bar<'.first(%'[a-z]+').check('foo')
+    '>foo    bar<'.first(%'[a-z]+' 6).check( 'bar' )
+}
+
+test {
+    '>foo    bar<'.last.check('<')
+    '>foo    bar<'.last(%'[a-z]+').check('bar')
+    '>foo    bar<'.last(%'[a-z]+' 6).check('foo')
+}

File src/test/kink/issue/ISSUE_0074.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #74
+# http://code.google.com/p/kink-lang/issues/detail?id=74
+
+test {
+    :Result = { 42 } .try.switch([true :Result] { Result })
+    Result.check(42)
+}

File src/test/kink/issue/ISSUE_0075.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+use('JAVA.int')
+use('JAVA.float')
+use('JAVA.double')
+use( 'org.kink_lang.kink.TypeOf' )
+use( 'java.lang.Double' )
+use( 'java.lang.Float' )
+use( 'java.lang.Integer' )
+
+# Tests issue #75
+# http://code.google.com/p/kink-lang/issues/detail?id=75
+
+test {
+    use('JAVA.null')
+    TypeOf.typeOf(3.14.exact(double)).check('double')
+    TypeOf.typeOf(3.14.exact(float)).check('float')
+    TypeOf.typeOf(3.14.exact(Double)).check('java.lang.Double')
+    TypeOf.typeOf(3.14.exact(Float)).check('java.lang.Float')
+    TypeOf.typeOf(null.exact(Double)).check('java.lang.Double')
+    TypeOf.typeOf(null.exact(Float)).check('java.lang.Float')
+}
+
+test {
+    :Num = 42.exact(int)
+    Num.cancast?(Integer).check(false)
+}
+
+test {
+    :Num = 42.cast(int)
+    Num.cancast?(Integer).check(true)
+}

File src/test/kink/issue/ISSUE_0078.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #78
+# http://code.google.com/p/kink-lang/issues/detail?id=78
+
+test {
+    [ 'foo'  'bar'  'baz' ].fold( '>> ' ) { \0 + \1 }.check( '>> foobarbaz' )
+    [ 'foo'  'bar'  'baz' ].fold { \0 + \1 }.check( 'foobarbaz' )
+}
+
+test {
+    [ 'foo'  'bar'  'baz' ].seq.fold( '>> ' ) { \0 + \1 }.check( '>> foobarbaz' )
+    [ 'foo'  'bar'  'baz' ].seq.fold { \0 + \1 }.check( 'foobarbaz' )
+}

File src/test/kink/issue/ISSUE_0079.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+# Tests issue #79
+# http://code.google.com/p/kink-lang/issues/detail?id=79
+
+test {
+    [ 10  20  30  40 ].sum.check( 10 + 20 + 30 + 40 )
+}
+
+test {
+    [ 10  20  30  40 ].sum( 5 ).check( 5 + 10 + 20 + 30 + 40 )
+}
+
+test {
+    [].sum.check( 0 )
+}
+
+test {
+    [].sum( 42 ).check( 42 )
+}
+
+test {
+    [ 'foo'  'bar'  'baz' ].sum.check( 'foo' + 'bar' + 'baz' )
+}
+
+test {
+    [ 'foo'  'bar'  'baz' ].sum( '--' ).check( '--' + 'foo' + 'bar' + 'baz' )
+}
+
+test {
+    [].sum( '--' ).check( '--' )
+}
+
+test {
+    [ 10  20  30  40 ].seq.sum.check( 10 + 20 + 30 + 40 )
+}
+
+test {
+    [].seq.sum.check( 0 )
+}

File src/test/kink/issue/ISSUE_0080.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+use('TEST.checkthrown')
+
+# Tests issue #80
+# http://code.google.com/p/kink-lang/issues/detail?id=80
+
+test {
+    [ 10  100  1000 ].average.check( ( 10 + 100 + 1000 ) / 3 )
+}
+
+test {
+    checkthrown { [].average }
+}
+
+test {
+    [ 10  100  1000 ].seq.average.check( ( 10 + 100 + 1000 ) / 3 )
+}
+
+test {
+    checkthrown { [].iter.average }
+}

File src/test/kink/issue/ISSUE_0095.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    use('java.util.concurrent.Callable')
+    :Voxxx_proxy = Callable.new { 'voxxx' }
+    Voxxx_proxy.call.check('voxxx')
+    :Twift_proxy = Callable.new { 'twift' }
+    Twift_proxy.call.check('twift')
+    # Two proxies must have the same proxy class
+    Voxxx_proxy.getClass.check(Twift_proxy.getClass)
+}
+
+test {
+    use('java.util.concurrent.Callable')
+    :Voxxx_proxy = Callable.newwith('call' { 'voxxx' })
+    Voxxx_proxy.call.check('voxxx')
+    :Twift_proxy = Callable.newwith('call' { 'twift' })
+    Twift_proxy.call.check('twift')
+    # Two proxies must have the same proxy class
+    Voxxx_proxy.getClass.check(Twift_proxy.getClass)
+}
+
+test {
+    use('java.util.AbstractList')
+    use('java.lang.IndexOutOfBoundsException')
+    :makeemptylist = AbstractList.with(
+        'size' { 0 }
+        'get' { IndexOutOfBoundsException.new(\0.show).throw }
+    )
+    :Empty_1 = makeemptylist
+    Empty_1.list.check([])
+    :Empty_2 = makeemptylist
+    Empty_2.list.check([])
+    # Two proxies must have the same proxy class
+    Empty_1.getClass.check(Empty_2.getClass)
+}

File src/test/kink/issue/ISSUE_0096.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    use('java.util.concurrent.Callable')
+    :makecallable = Callable.with('call' { 'voxxx' })
+    :Callable = makecallable
+    Callable.call.check('voxxx')
+}

File src/test/kink/issue/ISSUE_0099.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    :N = 42
+    expand('#N * 2 = #{ N * 2 }').check('42 * 2 = 84')
+}

File src/test/kink/issue/ISSUE_0101.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    [1 2 3 4].concatmap {
+        [ \0  \0 + 10 ]
+    } .check([1 11 2 12 3 13 4 14])
+}

File src/test/kink/issue/ISSUE_0106.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez")
+    Reader.line.check("voxxx\n")
+    Reader.line.check("twift\n")
+    Reader.line.check("rez")
+}
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez\n")
+    Reader.line.check("voxxx\n")
+    Reader.line.check("twift\n")
+    Reader.line.check("rez\n")
+}
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez")
+    Reader.lines.check(["voxxx\n" "twift\n" "rez"])
+}
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez\n")
+    Reader.lines.check(["voxxx\n" "twift\n" "rez\n"])
+}
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez")
+    :Seq = Reader.lineseq
+    Seq.list.check(["voxxx\n" "twift\n" "rez"])
+}
+
+test {
+    use('java.io.StringReader')
+    :Reader = StringReader.new("voxxx\ntwift\nrez\n")
+    :Seq = Reader.lineseq
+    Seq.list.check(["voxxx\n" "twift\n" "rez\n"])
+}

File src/test/kink/issue/ISSUE_0107.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    :factorial = { (:N)
+        :loop.do(1 N) { (:Accum :I)
+            I.switch(
+                1 { Accum }
+                (any) { loop(Accum * I I - 1) }
+            )
+        }
+    }
+    factorial(5).check(5 * 4 * 3 * 2 * 1)
+}

File src/test/kink/issue/ISSUE_0109.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    :List = ['voxxx' 'twift' 'peng']
+    List.:get.call(0).check('voxxx')
+}

File src/test/kink/issue/ISSUE_0110.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use('TEST.test')
+
+test {
+    :swap = { > :Me (:Xi :Yi)
+        :Oldx = Me.get(Xi)
+        Me.set(Xi Me.get(Yi))
+        Me.set(Yi Oldx)
+    }
+    :List = ['twift' 'voxxx' 'peng' 'olv']
+    $swap.withrecv(List).call(2 3)
+    List.check(['twift' 'voxxx' 'olv' 'peng'])
+}

File src/test/kink/issue/ISSUE_0111.kn

View file
  • Ignore whitespace
+#!/usr/bin/env kink
+# vim: et sw=4 sts=4
+
+# Copyright (c) 2013 Miyakawa Taku
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,