mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* stdlib tests now check refc too * typo * fixes line numbers * disable cpp * do not touch
30 lines
624 B
Nim
30 lines
624 B
Nim
discard """
|
|
output: "key: keyAYes!"
|
|
matrix: "--mm:refc; --mm:orc"
|
|
"""
|
|
# Test the new regular expression module
|
|
# which is based on the PCRE library
|
|
|
|
when defined(powerpc64):
|
|
# cheat as our powerpc test machine has no PCRE installed:
|
|
echo "key: keyAYes!"
|
|
|
|
else:
|
|
import
|
|
re
|
|
import std/syncio
|
|
if "keyA = valueA" =~ re"\s*(\w+)\s*\=\s*(\w+)":
|
|
write(stdout, "key: ", matches[0])
|
|
elif "# comment!" =~ re.re"\s*(\#.*)":
|
|
# test re.re"" syntax
|
|
echo("comment: ", matches[0])
|
|
else:
|
|
echo("Bug!")
|
|
|
|
if "Username".match(re"[A-Za-z]+"):
|
|
echo("Yes!")
|
|
else:
|
|
echo("Bug!")
|
|
|
|
#OUT key: keyAYes!
|