tests/test-extension.t
branchstable
changeset 46025 27c23c8f14da
parent 45008 e1ea913da2ed
child 45948 250e18437e30
equal deleted inserted replaced
46024:07b0a687c01a 46025:27c23c8f14da
  1397   $ cat > throw.py <<EOF
  1397   $ cat > throw.py <<EOF
  1398   > from mercurial import commands, registrar, util
  1398   > from mercurial import commands, registrar, util
  1399   > cmdtable = {}
  1399   > cmdtable = {}
  1400   > command = registrar.command(cmdtable)
  1400   > command = registrar.command(cmdtable)
  1401   > class Bogon(Exception): pass
  1401   > class Bogon(Exception): pass
       
  1402   > # NB: version should be bytes; simulating extension not ported to py3
       
  1403   > __version__ = '1.0.0'
  1402   > @command(b'throw', [], b'hg throw', norepo=True)
  1404   > @command(b'throw', [], b'hg throw', norepo=True)
  1403   > def throw(ui, **opts):
  1405   > def throw(ui, **opts):
  1404   >     """throws an exception"""
  1406   >     """throws an exception"""
  1405   >     raise Bogon()
  1407   >     raise Bogon()
  1406   > EOF
  1408   > EOF
       
  1409 
       
  1410 Test extension without proper byteification of key attributes doesn't crash when
       
  1411 accessed.
       
  1412 
       
  1413   $ hg version -v --config extensions.throw=throw.py | grep '^ '
       
  1414     throw  external  1.0.0
  1407 
  1415 
  1408 No declared supported version, extension complains:
  1416 No declared supported version, extension complains:
  1409   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1417   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1410   ** Unknown exception encountered with possibly-broken third-party extension throw
  1418   ** Unknown exception encountered with possibly-broken third-party extension throw
  1411   ** which supports versions unknown of Mercurial.
  1419   ** which supports versions unknown of Mercurial.