topics: add a test demonstarting sorting of topics by time using --age
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 14 Jul 2017 08:08:32 +0530
changeset 2747 9fd6c8efda5b
parent 2746 c64e2167514b
child 2748 723f5b505c48
topics: add a test demonstarting sorting of topics by time using --age
tests/test-topic.t
--- a/tests/test-topic.t	Fri Jul 14 03:16:06 2017 +0200
+++ b/tests/test-topic.t	Fri Jul 14 08:08:32 2017 +0530
@@ -864,4 +864,50 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     added a
   
+  $ hg topic topic1970 --rev 0
+  switching to topic topic1970
+  changed topic on 1 changes
+  $ hg add b
+  $ hg topic topic1990
+  $ hg ci -m "Added b" --config devel.default-date="631152000 0"
+  $ hg add c
+  $ hg topic topic2010
+  $ hg ci -m "Added c" --config devel.default-date="1262304000 0"
+  $ hg log
+  changeset:   3:9048b194797d
+  tag:         tip
+  topic:       topic2010
+  user:        test
+  date:        Fri Jan 01 00:00:00 2010 +0000
+  summary:     Added c
+  
+  changeset:   2:186d493c7f8d
+  topic:       topic1990
+  user:        test
+  date:        Mon Jan 01 00:00:00 1990 +0000
+  summary:     Added b
+  
+  changeset:   1:e5a30a141954
+  topic:       topic1970
+  parent:      -1:000000000000
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added a
+  
+  $ hg topics
+     topic1970
+     topic1990
+   * topic2010
+  $ hg topics --age
+   * topic2010 (2010-01-01)
+     topic1990 (1990-01-01)
+     topic1970 (1970-01-01)
+  $ hg up topic1970
+  switching to topic topic1970
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg topics --age
+     topic2010 (2010-01-01)
+     topic1990 (1990-01-01)
+   * topic1970 (1970-01-01)
+
   $ cd ..