summary refs log tree commit diff stats
path: root/test/tc_relative_symlink.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/tc_relative_symlink.py')
-rw-r--r--test/tc_relative_symlink.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/test/tc_relative_symlink.py b/test/tc_relative_symlink.py
deleted file mode 100644
index a202513d..00000000
--- a/test/tc_relative_symlink.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import os.path
-import sys
-rangerpath = os.path.join(os.path.dirname(__file__), '..')
-if sys.path[1] != rangerpath:
-	sys.path[1:1] = [rangerpath]
-
-import unittest
-from ranger.ext.relative_symlink import *
-rel = get_relative_source_file
-
-class Test(unittest.TestCase):
-	def test_foo(self):
-		self.assertEqual('../foo', rel('/foo', '/x/bar'))
-		self.assertEqual('../../foo', rel('/foo', '/x/y/bar'))
-		self.assertEqual('../../a/b/foo', rel('/a/b/foo', '/x/y/bar'))
-		self.assertEqual('../../x/b/foo', rel('/x/b/foo', '/x/y/bar',
-			common_base='/'))
-		self.assertEqual('../b/foo', rel('/x/b/foo', '/x/y/bar'))
-		self.assertEqual('../b/foo', rel('/x/b/foo', '/x/y/bar'))
-
-	def test_get_common_base(self):
-		self.assertEqual('/', get_common_base('', ''))
-		self.assertEqual('/', get_common_base('', '/'))
-		self.assertEqual('/', get_common_base('/', ''))
-		self.assertEqual('/', get_common_base('/', '/'))
-		self.assertEqual('/', get_common_base('/bla/bar/x', '/foo/bar/a'))
-		self.assertEqual('/foo/bar/', get_common_base('/foo/bar/x', '/foo/bar/a'))
-		self.assertEqual('/foo/', get_common_base('/foo/bar/x', '/foo/baz/a'))
-		self.assertEqual('/foo/', get_common_base('/foo/bar/x', '/foo/baz/a'))
-		self.assertEqual('/', get_common_base('//foo/bar/x', '/foo/baz/a'))
-
-if __name__ == '__main__': unittest.main()
Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
const zlib = (func(): string =
  let res = staticExec("pkg-config --libs --silence-errors zlib")
  if res != "":
    return res
)()
when zlib == "":
  error("zlib not found")

{.passL: zlib.}

const
  Z_NO_FLUSH* = cint(0)
  Z_PARTIAL_FLUSH* = cint(1)
  Z_SYNC_FLUSH* = cint(2)
  Z_FULL_FLUSH* = cint(3)
  Z_FINISH* = cint(4)
  Z_BLOCK* = cint(5)
  Z_TREES* = cint(6)

const
  Z_OK* = cint(0)
  Z_STREAM_END* = cint(1)
  Z_NEED_DICT* = cint(2)
  Z_ERRNO* = cint(-1)
  Z_STREAM_ERROR* = cint(-2)
  Z_DATA_ERROR* = cint(-3)
  Z_MEM_ERROR* = cint(-4)
  Z_BUF_ERROR* = cint(-5)
  Z_VERSION_ERROR* = cint(-6)

const
  Z_BINARY* = cint(0)
  Z_TEXT* = cint(1)
  Z_ASCII* = Z_TEXT
  Z_UNKNOWN* = cint(2)

type
  alloc_func* {.importc, header: "zlib.h".} = proc (opaque: pointer,
    items: cuint, size: cuint): pointer {.cdecl.}

  free_func* {.importc, header: "zlib.h".} = proc (opaque: pointer,
    address: pointer) {.cdecl.}

  internal_state* {.importc, header: "zlib.h".} = object

  z_stream* {.importc, header: "zlib.h".} = object
    next_in*: ptr uint8 # next input byte
    avail_in*: cuint # number of bytes available in next_in
    total_in*: culong # total number of input bytes read so far

    next_out*: ptr uint8 # next output byte will go here
    avail_out*: cuint # remaining free space at next_out
    total_out*: culong # total number of bytes output so far

    msg*: cstring # last error message, NULL if no error
    state*: ptr internal_state # not visible by applications

    zalloc*: alloc_func # used to allocate the internal state
    zfree*: free_func # used to free the internal state 
    opaque*: pointer # private data object passed to zalloc and zfree 

    data_type*: cint # best guess about the data type: binary or text
                     # for deflate, or the decoding state for inflate 
    adler*: culong # Adler-32 or CRC-32 value of the uncompressed data 
    reserved*: culong # reserved for future use 

  z_streamp* = ptr z_stream

{.push header: "zlib.h", importc, cdecl.}
proc inflateInit*(strm: z_streamp): cint
proc inflate*(strm: z_streamp, flush: cint): cint
proc inflateEnd*(strm: z_streamp): cint
proc compress*(dest: ptr uint8, destLen: ptr culong, source: ptr uint8,
  sourceLen: culong): cint
proc compressBound*(sourceLen: culong): culong
proc uncompress*(dest: ptr uint8, destLen: ptr culong, source: ptr uint8,
  sourceLen: culong): cint
proc crc32*(crc: culong, buf: ptr uint8, len: cuint): culong
{.pop.}