Exemplo n.º 1
0
	def testSettingsAreCorrectlyDefined(self):
		KNOWN_OPTIONS = {
			'hlsearch': vi_user_setting(scope=SCOPE_VIEW, values=(True, False), default=True, parser=None),
			'incsearch': vi_user_setting(scope=SCOPE_VIEW, values=(True, False), default=True, parser=None),
			'autoindent': vi_user_setting(scope=SCOPE_VIEW, values=(True, False), default=True, parser=None),
		}

		self.assertEqual(len(KNOWN_OPTIONS), len(VI_OPTIONS))
		for (k, v) in KNOWN_OPTIONS.items():
			self.assertEqual(VI_OPTIONS[k], v)
  def testSettingsAreCorrectlyDefined(self):
      KNOWN_OPTIONS = {
          'hlsearch':    vi_user_setting(scope=SCOPE_VI_VIEW,    values=(True, False, '0', '1'), default=True,  parser=opt_bool_parser,   action=set_generic_view_setting, negatable=True),
          'magic':       vi_user_setting(scope=SCOPE_VI_VIEW,    values=(True, False, '0', '1'), default=True,  parser=opt_bool_parser,   action=set_generic_view_setting, negatable=True),
          'incsearch':   vi_user_setting(scope=SCOPE_VI_VIEW,    values=(True, False, '0', '1'), default=True,  parser=opt_bool_parser,   action=set_generic_view_setting, negatable=True),
          'ignorecase':  vi_user_setting(scope=SCOPE_VI_VIEW,    values=(True, False, '0', '1'), default=False, parser=opt_bool_parser,   action=set_generic_view_setting, negatable=True),
          'autoindent':  vi_user_setting(scope=SCOPE_VI_VIEW,    values=(True, False, '0', '1'), default=True,  parser=None,              action=set_generic_view_setting, negatable=False),
          'showminimap': vi_user_setting(scope=SCOPE_WINDOW,     values=(True, False, '0', '1'), default=True,  parser=None,              action=set_minimap,              negatable=True),
          'visualbell':  vi_user_setting(scope=SCOPE_VI_WINDOW,  values=(True, False, '0', '1'), default=True,  parser=opt_bool_parser,   action=set_generic_view_setting, negatable=True),
          'rulers':      vi_user_setting(scope=SCOPE_VIEW,       values=None,                    default=[],    parser=opt_rulers_parser, action=set_generic_view_setting, negatable=False),
          'showsidebar': vi_user_setting(scope=SCOPE_WINDOW,     values=(True, False, '0', '1'), default=True,  parser=None,              action=set_sidebar,              negatable=True),
      }

      self.assertEqual(len(KNOWN_OPTIONS), len(VI_OPTIONS))
      for (k, v) in KNOWN_OPTIONS.items():
          self.assertEqual(VI_OPTIONS[k], v)
Exemplo n.º 3
0
	def testCanReturnViewLevelSetting(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=SCOPE_VIEW, values=(100,), default='bar', parser=None, action=None, noable=False)
		self.vi_settings.view.settings().set('vintageous_foo', 100)
		self.assertEqual(self.vi_settings['foo'], 100)
		del VI_OPTIONS['foo']
Exemplo n.º 4
0
	def testReturnsCorrectValue(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=None, values=(100, 200), default='bar', parser=None, action=None, noable=False)
		self.vi_settings.view.settings().set('vintageous_foo', 200)
		self.assertEqual(self.vi_settings['foo'], 200)
		del VI_OPTIONS['foo']
Exemplo n.º 5
0
	def testReturnsDefaultValueIfSetToWrongValue(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=None, values=(100,), default='bar', parser=None, action=None, noable=False)
		self.vi_settings.view.settings().set('vintageous_foo', 'maraca')
		self.assertEqual(self.vi_settings['foo'], 'bar')
		del VI_OPTIONS['foo']
Exemplo n.º 6
0
	def testReturnsDefaultValueIfUnset(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=None, values=(100,), default='bar', parser=None, action=None, noable=False)
		self.assertEqual(self.vi_settings['foo'], 'bar')
		del VI_OPTIONS['foo']
Exemplo n.º 7
0
	def testDefaultScopeIsView(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=None, values=(100,), default='bar', parser=None, action=None, noable=False)
		self.vi_settings.view.settings().set('vintageous_foo', 100)
		self.assertEqual(self.vi_settings['foo'], 100)
		del VI_OPTIONS['foo']
Exemplo n.º 8
0
	def testCanRetrieveWindowLevelSettings(self):
		# TODO: use mock to patch dict
		VI_OPTIONS['foo'] = vi_user_setting(scope=SCOPE_WINDOW, values=(100,), default='bar', parser=None, action=None, noable=False)
		self.settsman.view.window().settings().set('vintageous_foo', 100)
		self.assertEqual(self.settsman['foo'], 100)
		del VI_OPTIONS['foo']
Exemplo n.º 9
0
	def testCanReturnWindowLevelSetting(self):
		VI_OPTIONS['foo'] = vi_user_setting(scope=SCOPE_WINDOW, values=(100,), default='bar', parser=None)
		self.vi_settings.view.window().settings().set('vintageous_foo', 100)
		self.assertEqual(self.vi_settings['foo'], 100)
		del VI_OPTIONS['foo']