mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
version 0.8.8
This commit is contained in:
5
tests/accept/compile/tconvcolors.nim
Executable file
5
tests/accept/compile/tconvcolors.nim
Executable file
@@ -0,0 +1,5 @@
|
||||
|
||||
import colors
|
||||
|
||||
echo int32(colWhite), 'A'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import dialogs, gtk2
|
||||
|
||||
gtk_nimrod_init()
|
||||
gtk2.nimrod_init()
|
||||
|
||||
var x = ChooseFilesToOpen(nil)
|
||||
for a in items(x):
|
||||
|
||||
@@ -3,10 +3,10 @@ import
|
||||
gtk2, glib2, atk, gdk2, gdk2pixbuf, libglade2, pango,
|
||||
pangoutils
|
||||
|
||||
proc hello(widget: PGtkWidget, data: pointer) {.cdecl.} =
|
||||
proc hello(widget: PWidget, data: pointer) {.cdecl.} =
|
||||
write(stdout, "Hello World\n")
|
||||
|
||||
proc delete_event(widget: PGtkWidget, event: PGdkEvent,
|
||||
proc delete_event(widget: PWidget, event: PEvent,
|
||||
data: pointer): bool {.cdecl.} =
|
||||
# If you return FALSE in the "delete_event" signal handler,
|
||||
# GTK will emit the "destroy" signal. Returning TRUE means
|
||||
@@ -19,43 +19,33 @@ proc delete_event(widget: PGtkWidget, event: PGdkEvent,
|
||||
return false
|
||||
|
||||
# Another callback
|
||||
proc destroy(widget: PGtkWidget, data: pointer) {.cdecl.} =
|
||||
gtk_main_quit()
|
||||
proc mydestroy(widget: PWidget, data: pointer) {.cdecl.} =
|
||||
gtk2.main_quit()
|
||||
|
||||
proc main() =
|
||||
proc mymain() =
|
||||
# GtkWidget is the storage type for widgets
|
||||
var
|
||||
window: PGtkWindow
|
||||
button: PGtkButton
|
||||
|
||||
gtk_nimrod_init()
|
||||
window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL))
|
||||
gtk2.nimrod_init()
|
||||
var window = window_new(gtk2.WINDOW_TOPLEVEL)
|
||||
discard g_signal_connect(window, "delete_event",
|
||||
Gcallback(delete_event), nil)
|
||||
discard g_signal_connect(window, "destroy", Gcallback(destroy), nil)
|
||||
discard g_signal_connect(window, "destroy", Gcallback(mydestroy), nil)
|
||||
# Sets the border width of the window.
|
||||
gtk_container_set_border_width(window, 10)
|
||||
set_border_width(window, 10)
|
||||
|
||||
# Creates a new button with the label "Hello World".
|
||||
button = GTK_BUTTON(gtk_button_new_with_label("Hello World"))
|
||||
var button = button_new("Hello World")
|
||||
|
||||
discard g_signal_connect(button, "clicked", Gcallback(hello), nil)
|
||||
|
||||
# This will cause the window to be destroyed by calling
|
||||
# gtk_widget_destroy(window) when "clicked". Again, the destroy
|
||||
# signal could come from here, or the window manager.
|
||||
discard g_signal_connect_swapped(button, "clicked",
|
||||
Gcallback(gtk_widget_destroy), window)
|
||||
|
||||
# This packs the button into the window (a gtk container).
|
||||
gtk_container_add(window, button)
|
||||
add(window, button)
|
||||
|
||||
# The final step is to display this newly created widget.
|
||||
gtk_widget_show(button)
|
||||
show(button)
|
||||
|
||||
# and the window
|
||||
gtk_widget_show(window)
|
||||
show(window)
|
||||
|
||||
gtk_main()
|
||||
gtk2.main()
|
||||
|
||||
main()
|
||||
mymain()
|
||||
|
||||
@@ -18,7 +18,7 @@ proc splitText(txt: string): seq[string] # splits a text into several lines
|
||||
# the comment continues here
|
||||
# this is not easy to parse!
|
||||
|
||||
proc anotherSplit(txt: string): list[string] =
|
||||
proc anotherSplit(txt: string): seq[string] =
|
||||
# the comment should belong to `anotherSplit`!
|
||||
# another problem: comments are statements!
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ import
|
||||
cairowin32, cairoxlib,
|
||||
odbcsql,
|
||||
gl, glut, glu, glx, glext, wingl,
|
||||
lua, lualib, lauxlib, mysql, sqlite3, python, tcl
|
||||
lua, lualib, lauxlib, mysql, sqlite3, python, tcl,
|
||||
db_postgres, db_mysql, db_sqlite, ropes, sockets, browsers, httpserver,
|
||||
httpclient, parseutils, unidecode, xmldom, xmldomparser, xmltree, xmlparser,
|
||||
htmlparser, re, graphics, colors
|
||||
|
||||
when defined(linux):
|
||||
import
|
||||
|
||||
7
tests/accept/compile/tnoargopenarray.nim
Normal file
7
tests/accept/compile/tnoargopenarray.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
import db_sqlite
|
||||
|
||||
var db: TDbConn
|
||||
Exec(db, sql"create table blabla()")
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ tbintree.nim;halloworld99110223
|
||||
tbug499771.nim;TSubRange: 5 from 1 to 10
|
||||
tbug511622.nim;3
|
||||
tcasestm.nim;ayyy
|
||||
tcgbug.nim;
|
||||
tclosure.nim;2 4 6 8 10
|
||||
tcnstseq.nim;AngelikaAnneAnnaAnkaAnja
|
||||
tconstr2.nim;69
|
||||
|
||||
|
17
tests/accept/run/tcgbug.nim
Normal file
17
tests/accept/run/tcgbug.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
type
|
||||
TObj = object
|
||||
x, y: int
|
||||
PObj = ref TObj
|
||||
|
||||
proc p(a: PObj) =
|
||||
a.x = 0
|
||||
|
||||
proc q(a: var PObj) =
|
||||
a.p()
|
||||
|
||||
var
|
||||
a: PObj
|
||||
new(a)
|
||||
q(a)
|
||||
|
||||
6
tests/accept/run/txmlgen.nim
Executable file
6
tests/accept/run/txmlgen.nim
Executable file
@@ -0,0 +1,6 @@
|
||||
import xmlgen
|
||||
|
||||
var nim = "Nimrod"
|
||||
echo h1(a(href="http://force7.de/nimrod", nim))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import xmltree
|
||||
import xmltree, strtabs
|
||||
|
||||
var x = <>a(href="nimrod.de", "www.nimrod-test.de")
|
||||
var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
|
||||
|
||||
echo x == "<a href=\"nimrod.de\">www.nimrod-test.de"
|
||||
echo($x == "<a href=\"nimrod.de\">www.nimrod-test.de</a>")
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ tambsym2.nim;4;undeclared identifier: 'CreateRGBSurface'
|
||||
tambsym3.nim;6;ambiguous identifier
|
||||
tatomic.nim;2;identifier expected, but found 'atomic'
|
||||
tbind2.nim;7;ambiguous call
|
||||
tbind4.nim;4;instantiation from here
|
||||
tbind4.nim;4;undeclared identifier: 'lastId'
|
||||
tblock1.nim;9;undeclared identifier: 'ha'
|
||||
tconstr1.nim;20;type mismatch
|
||||
tillrec.nim;8;illegal recursion in type 'TIllegal'
|
||||
tinc.nim;3;to var type a variable needs to be passed
|
||||
tinc.nim;3;for a 'var' type a variable needs to be passed
|
||||
tinout.nim;7;for a 'var' type a variable needs to be passed
|
||||
tinvalidnewseq.nim;10;type mismatch: got (array[0..6, string], int)
|
||||
tinvwhen.nim;6;invalid indentation
|
||||
|
||||
|
6
tests/reject/tambsym2.nim
Executable file
6
tests/reject/tambsym2.nim
Executable file
@@ -0,0 +1,6 @@
|
||||
|
||||
from sdl import PSurface
|
||||
|
||||
discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34,
|
||||
32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var x = 0
|
||||
|
||||
inc(x+1) #ERROR_MSG to var type a variable needs to be passed
|
||||
inc(x+1)
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ type
|
||||
msg: string,
|
||||
err: bool]
|
||||
TOutp = tuple[file, outp: string]
|
||||
TResult = tuple[test, expected, given: string, success: bool]
|
||||
TResults = object
|
||||
total, passed: int
|
||||
data: string
|
||||
@@ -100,7 +99,7 @@ proc colorBool(b: bool): string =
|
||||
const
|
||||
TableHeader4 = "<table border=\"1\"><tr><td>Test</td><td>Expected</td>" &
|
||||
"<td>Given</td><td>Success</td></tr>\n"
|
||||
TableHeader3 = "<table border=\"1\"><tr><td>Test</td><td>Expected</td>" &
|
||||
TableHeader3 = "<table border=\"1\"><tr><td>Test</td>" &
|
||||
"<td>Given</td><td>Success</td></tr>\n"
|
||||
TableFooter = "</table>\n"
|
||||
|
||||
@@ -149,8 +148,6 @@ proc reject(r: var TResults, dir, options: string) =
|
||||
var expected = findSpec(specs, t)
|
||||
var given = callCompiler(test, options)
|
||||
cmpMsgs(r, specs[expected], given, t)
|
||||
|
||||
if r.total > 3: break
|
||||
|
||||
proc compile(r: var TResults, pattern, options: string) =
|
||||
for test in os.walkFiles(pattern):
|
||||
@@ -159,7 +156,6 @@ proc compile(r: var TResults, pattern, options: string) =
|
||||
var given = callCompiler(test, options)
|
||||
r.addResult(t, given.msg, not given.err)
|
||||
if not given.err: inc(r.passed)
|
||||
if r.total > 3: break
|
||||
|
||||
proc run(r: var TResults, dir, options: string) =
|
||||
var specs = parseRunData(dir)
|
||||
@@ -179,7 +175,6 @@ proc run(r: var TResults, dir, options: string) =
|
||||
r.addResult(t, expected.outp, buf, success)
|
||||
else:
|
||||
r.addResult(t, expected.outp, "executable not found", false)
|
||||
if r.total > 3: break
|
||||
|
||||
var options = ""
|
||||
var rejectRes = initResults()
|
||||
|
||||
Reference in New Issue
Block a user