mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tools: cleanup entries from the hardcoded skip_files list in common.v (used by v test
, v test-self
etc); use the new // vtest build:
syntax to mark the tests instead (#23918)
This commit is contained in:
parent
9f3f1291e8
commit
a80bc23314
109 changed files with 208 additions and 322 deletions
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !windows // requires mmap
|
||||
import flag
|
||||
import math
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !msvc
|
||||
fn main() {
|
||||
a := 100
|
||||
b := 20
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: false // Check the README.md for detailed information; this file needs special compilation options
|
||||
module test_math
|
||||
|
||||
import math
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: false // Check the README.md for detailed information; this file needs special compilation options
|
||||
module test_print
|
||||
|
||||
@[export: 'foo']
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_python? // the example only makes sense to be compiled, when python is installed
|
||||
module test
|
||||
|
||||
// Note: compile this with `v -d no_backtrace -shared test.v`
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_ruby? // the example only makes sense to be compiled, when ruby is installed
|
||||
module test
|
||||
|
||||
import math
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Build with (-gc none, until GC bug is fixed)
|
||||
// v -gc none -use-coroutines coroutine_benchs.v
|
||||
//
|
||||
// vtest build: false // This should be build with: `v -use-coroutines coroutine_benchs.v`
|
||||
// Note: the Photon wrapper is not yet trivial enough to build/install on the CI.
|
||||
import coroutines
|
||||
import time
|
||||
import net.http
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Build with
|
||||
// v -use-coroutines simple_coroutines.v
|
||||
//
|
||||
// vtest build: false // This should be build with: v -use-coroutines simple_coroutines.v
|
||||
// Note: the Photon wrapper is not yet trivial enough to build/install on the CI.
|
||||
import coroutines
|
||||
import time
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !(macos || windows)
|
||||
import db.mysql
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !(macos || windows)
|
||||
import os
|
||||
import db.sqlite
|
||||
import db.mysql
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
// vtest build: linux
|
||||
module main
|
||||
|
||||
/*
|
||||
import db.pg
|
||||
*/
|
||||
|
||||
const dash = '----------------------------------------------------------------'
|
||||
|
||||
struct Customer {
|
||||
id int
|
||||
|
@ -13,53 +10,62 @@ struct Customer {
|
|||
country string
|
||||
}
|
||||
|
||||
const dash = '----------------------------------------------------------------'
|
||||
|
||||
fn main() {
|
||||
/*
|
||||
db := pg.connect(pg.Config{
|
||||
host: 'localhost' //'127.0.0.1'
|
||||
user: 'postgres'
|
||||
db := pg.connect(
|
||||
host: 'localhost' // or '127.0.0.1'
|
||||
user: 'postgres'
|
||||
dbname: 'customerdb'
|
||||
}) or {
|
||||
println('failed to connect')
|
||||
println(err)
|
||||
) or {
|
||||
eprintln('failed to connect, error: ${err}')
|
||||
return
|
||||
}
|
||||
|
||||
nr_customers := db.select count from Customer
|
||||
println('Total customers: $nr_customers')
|
||||
nr_customers := sql db {
|
||||
select count from Customer
|
||||
}!
|
||||
println('Total customers: ${nr_customers}')
|
||||
|
||||
// V syntax can be used to build queries
|
||||
println(dash)
|
||||
bg_country := 'Bulgaria'
|
||||
bg_customers := db.select from Customer where country == bg_country && id != 2
|
||||
// V syntax can be used to build queries
|
||||
bg_customers := sql db {
|
||||
select from Customer where country == bg_country && id != 2
|
||||
}!
|
||||
for customer in bg_customers {
|
||||
println('$customer.country | $customer.id - $customer.name')
|
||||
println('${customer.country} | ${customer.id} - ${customer.name}')
|
||||
}
|
||||
|
||||
println(dash)
|
||||
ru_customers := db.select from Customer where country == 'Russia'
|
||||
ru_customers := sql db {
|
||||
select from Customer where country == 'Russia'
|
||||
}!
|
||||
for customer in ru_customers {
|
||||
println('$customer.country | $customer.id - $customer.name')
|
||||
println('${customer.country} | ${customer.id} - ${customer.name}')
|
||||
}
|
||||
|
||||
// by adding `limit 1` we tell V that there will be only one object
|
||||
println(dash)
|
||||
existing := db.select from Customer where id == 1 limit 1 or { panic(err) }
|
||||
println('Existing customer name: $existing.name')
|
||||
existing := sql db {
|
||||
select from Customer where id == 1 limit 1
|
||||
}!
|
||||
println('Existing customer name: ${existing}[0].name')
|
||||
println('Existing customer full information:')
|
||||
println(existing)
|
||||
|
||||
println(dash)
|
||||
q := Customer{}
|
||||
// It's easy to handle queries that don't return any data
|
||||
if anon := db.select from Customer where id == 12345 && name == q.name &&
|
||||
nr_orders > q.nr_orders limit 1 {
|
||||
println('Non existing customer name: $anon.name')
|
||||
}
|
||||
_ := sql db {
|
||||
select from Customer where id == 12345 && name == q.name && nr_orders > q.nr_orders limit 1
|
||||
}!
|
||||
// Insert a new customer
|
||||
nc := Customer{
|
||||
name: 'John Doe'
|
||||
name: 'John Doe'
|
||||
nr_orders: 10
|
||||
}
|
||||
db.insert(nc)*/
|
||||
sql db {
|
||||
insert nc into Customer
|
||||
}!
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Simple windows-less application that shows a icon button
|
||||
// on Mac OS tray.
|
||||
//
|
||||
// vtest build: macos
|
||||
// Simple windows-less application that shows a icon button on Mac OS tray.
|
||||
// Tested on Mac OS Monterey (12.3).
|
||||
|
||||
module main
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !(windows && gcc) // it declares its own `main` function, but on windows && gcc, it needs to be `wWinMain`
|
||||
module no_main
|
||||
|
||||
// Compile with:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !solaris
|
||||
import json
|
||||
import picoev
|
||||
import picohttpparser
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !solaris
|
||||
module main
|
||||
|
||||
import net
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_openssl?
|
||||
// Creator: nedimf (07/2020)
|
||||
import os
|
||||
import net.smtp
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
/**********************************************************************
|
||||
*
|
||||
* Sokol 3d cube demo
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
/**********************************************************************
|
||||
*
|
||||
* Sokol 3d cube demo
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
/**********************************************************************
|
||||
* Sokol 3d cube multishader demo
|
||||
* Copyright (c) 2024 Dario Deledda. All rights reserved.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
/**********************************************************************
|
||||
*
|
||||
* Sokol 3d cube multishader demo
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
/**********************************************************************
|
||||
*
|
||||
* .obj viewer
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright(C) 2022 Lars Pontoppidan. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license file distributed with this software package
|
||||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
module main
|
||||
|
||||
// Example shader triangle adapted to V from https://github.com/floooh/sokol-samples/blob/1f2ad36/sapp/triangle-sapp.c
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// A Signed Distance Field rendering demo, ported from https://github.com/floooh/sokol-samples/blob/master/sapp/sdf-sapp.c
|
||||
// which in turn is based on https://iquilezles.org/articles/mandelbulb/ and https://www.shadertoy.com/view/ltfSWn
|
||||
// vtest build: misc-tooling // needs .h files that are produced by `v shader`
|
||||
import sokol.sapp
|
||||
import sokol.gfx
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !solaris
|
||||
import sokol.sapp
|
||||
import sokol.gfx
|
||||
import sokol.sgl
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !solaris
|
||||
import sokol.sapp
|
||||
import sokol.gfx
|
||||
import sokol.sgl
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !sanitize-memory-clang // Fails compilation with: `ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
|
||||
// import log
|
||||
import math
|
||||
import time
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: !sanitize-memory-clang // Fails compilation with: `ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line`
|
||||
import time
|
||||
import math
|
||||
import sokol.audio
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: false // requires special compilation flags: `-b wasm -os browser`
|
||||
fn JS.change_color_by_id(ptr u8, len int, color_ptr u8, color_len int)
|
||||
|
||||
// `main` must be public!
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: false // requires special compilation flags: `-b wasm -os browser`
|
||||
fn JS.canvas_x() int
|
||||
fn JS.canvas_y() int
|
||||
fn JS.setpixel(x int, y int, c f64)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_openssl?
|
||||
module main
|
||||
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_openssl?
|
||||
module main
|
||||
|
||||
import net.websocket
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// vtest build: present_openssl?
|
||||
module main
|
||||
|
||||
import time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue