tests/test-extension.t
changeset 45962 3db545fccac1
parent 45026 e1ea913da2ed
child 45963 250e18437e30
equal deleted inserted replaced
45961:464539c305aa 45962:3db545fccac1
  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.