prelude.nim 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2012 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. when defined(nimdoc) and isMainModule:
  10. from std/compileSettings import nil
  11. when compileSettings.querySetting(compileSettings.SingleValueSetting.projectFull) == currentSourcePath:
  12. ## This is an include file that simply imports common modules for your convenience.
  13. runnableExamples:
  14. include std/prelude
  15. # same as:
  16. # import std/[os, strutils, times, parseutils, hashes, tables, sets, sequtils, parseopt, strformat]
  17. let x = 1
  18. assert "foo $# $#" % [$x, "bar"] == "foo 1 bar"
  19. assert toSeq(1..3) == @[1, 2, 3]
  20. when not defined(js) or defined(nodejs):
  21. assert getCurrentDir().len > 0
  22. assert ($now()).startsWith "20"
  23. # xxx `nim doc -b:js -d:nodejs --doccmd:-d:nodejs lib/pure/prelude.nim` fails for some reason
  24. # specific to `nim doc`, but the code otherwise works with nodejs.
  25. import std/[os, strutils, times, parseutils, hashes, tables, sets, sequtils, parseopt, strformat]