tnimblecmd.nim 933 B

123456789101112131415161718192021222324252627
  1. include compiler/[nimblecmd]
  2. proc v(s: string): Version = s.newVersion
  3. # #head is special in the sense that it's assumed to always be newest.
  4. doAssert v"1.0" < v"#head"
  5. doAssert v"1.0" < v"1.1"
  6. doAssert v"1.0.1" < v"1.1"
  7. doAssert v"1" < v"1.1"
  8. doAssert v"#aaaqwe" < v"1.1" # We cannot assume that a branch is newer.
  9. doAssert v"#a111" < v"#head"
  10. let conf = newConfigRef()
  11. var rr = newStringTable()
  12. addPackage conf, rr, "irc-#a111", unknownLineInfo
  13. addPackage conf, rr, "irc-#head", unknownLineInfo
  14. addPackage conf, rr, "irc-0.1.0", unknownLineInfo
  15. #addPackage conf, rr, "irc", unknownLineInfo
  16. #addPackage conf, rr, "another", unknownLineInfo
  17. addPackage conf, rr, "another-0.1", unknownLineInfo
  18. addPackage conf, rr, "ab-0.1.3", unknownLineInfo
  19. addPackage conf, rr, "ab-0.1", unknownLineInfo
  20. addPackage conf, rr, "justone-1.0", unknownLineInfo
  21. doAssert toSeq(rr.chosen) ==
  22. @["irc-#head", "ab-0.1.3", "justone-1.0", "another-0.1"]