Skip to content

Commit ae4914d

Browse files
committed
Updates test server.
1 parent 382c32d commit ae4914d

File tree

4 files changed

+51
-16
lines changed

4 files changed

+51
-16
lines changed

test/browser/src/livescript-test.ls

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
console.log "livescript!"
2+
3+
times = (x, y) --> x * y
4+
console.log 'times 2, 3 #=> 6', times 2, 3 #=> 6 (normal use works as expected)
5+
double = times 2
6+
console.log 'double 5 #=> 10', double 5 #=> 10
7+
8+
filter-nums = filter _, [1 to 5]
9+
console.log 'filter-nums even #=> [2,4]', filter-nums even #=> [2,4]
10+
console.log 'filter-nums odd #=> [1,3,5]', filter-nums odd #=> [1,3,5]
11+
console.log 'filter-nums (< 3) #=> [1,2]', filter-nums (< 3) #=> [1,2]
12+
13+
r = [1 2 3]
14+
|> _.map _, (* 2)
15+
|> _.reduce _, (+), 0
16+
console.log '[1 2 3] |> map |> reduce #=> 12', r

test/browser/src/pythagoras.co

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export pythagorases =
2+
for a from 9 to 1 by -1
3+
for b from a til 99
4+
h = (a*a + b*b) ** 0.5
5+
[a, b, h] unless h % 1
6+

test/browser/test.co

-2
This file was deleted.

test/server/server.co

+29-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
path = require 'path'
1+
{ dirname, basename,
2+
} = path = require 'path'
23
express = require 'express'
34

4-
55
PORT = 8080
6-
PROJECT_DIR = path.dirname __dirname
7-
TESTS = __dirname
6+
TESTS = dirname __dirname
7+
PROJECT_DIR = dirname TESTS
8+
VAR = PROJECT_DIR+'/var'
89
WWW = TESTS+'/browser'
9-
VAR = TESTS+'/var'
10+
SRC = WWW+'/src'
11+
1012

1113
compiler = require PROJECT_DIR+'/compiler'
1214

1315

1416
app = express.createServer()
1517
app.listen PORT
1618

17-
console.log "Test Server started on port #PORT..."
19+
console.log ">> Connect Compiler Test Server <<"
20+
console.log ' PORT: ', PORT
21+
console.log ' PROJECT_DIR: ', PROJECT_DIR
22+
console.log ' TESTS: ', TESTS
23+
console.log ' WWW: ', WWW
24+
console.log ' VAR: ', VAR
1825

1926
app.configure ->
2027
console.log 'server.configure()'
@@ -24,19 +31,27 @@ app.configure ->
2431
app.use express.methodOverride()
2532

2633
app.use compiler do
27-
enabled : <[ coco coffee jade stylus sass jison ]>
34+
enabled : <[ livescript coco coffee ]>
2835
src : WWW
2936
dest : VAR
30-
options :
31-
stylus : nib:true, compress:true
37+
# options :
38+
# stylus : nib:true, compress:true
3239
log_level : 'DEBUG'
3340

41+
# app.use compiler do
42+
# enabled : <[ jade stylus sass jison ]>
43+
# src : WWW
44+
# dest : VAR
45+
# options :
46+
# stylus : nib:true, compress:true
47+
# log_level : 'DEBUG'
48+
3449
# compress anything that desires compression (*.min.js)
35-
app.use compiler do
36-
enabled : <[ uglify ]>
37-
src : [ WWW, VAR ]
38-
dest : VAR
39-
log_level : 'DEBUG'
50+
# app.use compiler do
51+
# enabled : <[ uglify ]>
52+
# src : [ WWW, VAR ]
53+
# dest : VAR
54+
# log_level : 'DEBUG'
4055

4156
app.use express.static WWW
4257
app.use express.static VAR

0 commit comments

Comments
 (0)