forked from dylan-sutton-chavez/edge-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.json
More file actions
130 lines (130 loc) · 3.35 KB
/
cli.json
File metadata and controls
130 lines (130 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[
{
"run": ["init", "myapp"],
"stdout": ["created myapp/"],
"creates": ["myapp/main.py", "myapp/packages.json", "myapp/index.html"]
},
{
"run": ["init", "myapp", "--bare"],
"creates": ["myapp/main.py", "myapp/packages.json"]
},
{
"given": { "myapp/.keep": "" },
"run": ["init", "myapp"],
"fails": ["already exists"]
},
{
"run": ["init"],
"stdout": ["created project/"],
"creates": ["main.py", "packages.json", "index.html"]
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "math"],
"stdout": ["+ math", "std"],
"contains": { "packages.json": "cdn.edgepython.com/std/math.wasm" }
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "network"],
"stdout": ["+ network", "host"],
"contains": { "packages.json": "cdn.edgepython.com/host/network/index.js" }
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "test"],
"stdout": ["+ test", "std"],
"contains": { "packages.json": "cdn.edgepython.com/std/test.py" }
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "foo=https://example.com/foo.wasm"],
"contains": { "packages.json": "example.com/foo.wasm" }
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "mystery"],
"fails": ["unknown package 'mystery'"]
},
{
"given": { "packages.json": "{}\n" },
"run": ["add", "math", "mystery"],
"fails": ["unknown package 'mystery'"],
"contains": { "packages.json": "{}\n" }
},
{
"run": ["add"],
"fails": ["nothing to add"]
},
{
"given": { "packages.json": "{\"imports\":{\"math\":\"https://cdn.edgepython.com/std/math.wasm\"}}\n" },
"run": ["remove", "math"],
"stdout": ["- math"]
},
{
"given": { "packages.json": "{}\n" },
"run": ["remove", "math"],
"fails": ["not in"]
},
{
"given": { "packages.json": "{\"imports\":{\"math\":\"https://cdn.edgepython.com/std/math.wasm\"}}\n" },
"run": ["remove", "math", "mystery"],
"fails": ["not in"],
"contains": { "packages.json": "math.wasm" }
},
{
"run": ["remove"],
"fails": ["nothing to remove"]
},
{
"given": { "custom.json": "{}\n" },
"run": ["--packages", "custom.json", "add", "math"],
"contains": { "custom.json": "cdn.edgepython.com/std/math.wasm" }
},
{
"run": ["run", "no_such.py"],
"fails": ["reading no_such.py"]
},
{
"run": ["runn"],
"fails": ["unrecognized subcommand"]
},
{
"run": ["test"],
"fails": ["not wired yet"]
},
{
"run": ["--version"],
"stdout": ["edge 0.1.0"]
},
{
"given": { "t.py": "print('hi from edge')\n" },
"run": ["run", "t.py"],
"stdout": ["hi from edge"]
},
{
"given": { "boom.py": "x = 1 / 0\n" },
"run": ["run", "boom.py"],
"fails": ["ZeroDivisionError"]
},
{
"given": { "main.py": "print('ok')\n", "packages.json": "{}\n" },
"run": ["build"],
"creates": ["dist/index.html", "dist/main.py", "dist/compiler.wasm"]
},
{
"run": ["repl"],
"stdin": "from math import sqrt\ndef double(n):\n return sqrt(n) * 2\n\nprint(double(4))\n.exit\n",
"stdout": ["4.0"]
},
{
"run": ["repl"],
"stdin": "x = 42\n.reset\nprint(x)\n.exit\n",
"stderr": ["NameError"]
},
{
"run": ["repl"],
"stdin": "from time import sleep\nsleep(0.05)\nprint(\"done\")\n.exit\n",
"stdout": ["done"]
}
]