Skip to content

Commit

Permalink
Started testing cli commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Aug 9, 2024
1 parent 7106de9 commit e18f241
Show file tree
Hide file tree
Showing 389 changed files with 2,697 additions and 8,494 deletions.
4 changes: 4 additions & 0 deletions .ameba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Documentation/DocumentationAdmonition:

Lint/UselessAssign:
ExcludeTypeDeclarations: true

Lint/SpecFilename:
Excluded:
- spec/spec_helpers.cr
3 changes: 3 additions & 0 deletions .github/workflows/ci-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Run specs
run: crystal spec --error-on-warnings --error-trace

- name: Run CLI specs
run: crystal spec spec_cli/*_spec.cr --error-on-warnings --error-trace

- name: Build the binary
run: shards build --error-on-warnings --error-trace

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ build: bin/mint
spec:
crystal spec --error-on-warnings --error-trace --progress

.PHONY: spec-cli
spec-cli: build
crystal spec spec_cli/*_spec.cr --error-on-warnings --error-trace --progress

.PHONY: format
format:
crystal tool format
Expand Down
1 change: 0 additions & 1 deletion core/docs.json

This file was deleted.

3 changes: 3 additions & 0 deletions source.mint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type Test {
file : String
}
19 changes: 4 additions & 15 deletions spec/compilers/access
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,8 @@ component Main {
}
}
--------------------------------------------------------------------------------
const A = _R({
name: [
"name",
Decoder.string
]
});

class B extends _C {
render() {
return new A({
name: `test`
}).name;
}
export const A = () => {
return {
name: `test`
}.name
};

B.displayName = "Main";
File renamed without changes.
17 changes: 6 additions & 11 deletions spec/compilers/argument
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
a(b, c) {
return c;
}

render() {
this.a(``, 0);
return ``;
}
export const A = () => {
const a = (b, c) => {
return c
};
a(``, 0);
return ``
};

A.displayName = "Main";
17 changes: 6 additions & 11 deletions spec/compilers/argument_with_default
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
a(b, c = 0) {
return c;
}

render() {
this.a(``);
return ``;
}
export const A = () => {
const a = (b, c = 0) => {
return c
};
a(``);
return ``
};

A.displayName = "Main";
17 changes: 6 additions & 11 deletions spec/compilers/argument_with_default_inline_function
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
render() {
const c = (b, a = 0) => {
return a
};

c(``);
return ``;
}
export const A = () => {
const a = (b, c = 0) => {
return c
};
a(``);
return ``
};

A.displayName = "Main";
24 changes: 8 additions & 16 deletions spec/compilers/array_literal
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
component Main {
fun test : Array(String) {
fun render : String {
[
"Hello",
"Blah",
"Joe"
]
}

fun render : String {
test()

""
}
}
--------------------------------------------------------------------------------
class A extends _C {
a() {
return [`Hello`, `Blah`, `Joe`];
}

render() {
this.a();
return ``;
}
export const A = () => {
[
`Hello`,
`Blah`,
`Joe`
];
return ``
};

A.displayName = "Main";
10 changes: 3 additions & 7 deletions spec/compilers/block
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
render() {
const a = `Some string...`;
return a + `, other string...`;
}
export const A = () => {
const a = `Some string...`;
return a + `, other string...`
};

A.displayName = "Main";
25 changes: 10 additions & 15 deletions spec/compilers/block_with_await
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
a() {
return;
}

async b() {
return await this.a();
}

render() {
this.b();
return `Hello`;
}
export const A = () => {
const
a = () => {
return undefined
},
b = async () => {
return await a()
};
b();
return `Hello`
};

A.displayName = "Main";
45 changes: 16 additions & 29 deletions spec/compilers/block_with_early_return
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,22 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class B extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class C extends _C {
render() {
const b = __match(_n(A)(`Some string...`), _PE(A,[
_PV
]));
import {
patternVariable as H,
destructure as E,
newVariant as F,
pattern as G,
variant as B
} from "./runtime.js";

if (b === false) {
export const
A = B(1),
C = B(1),
D = () => {
const a = E(F(A)(`Some string...`), G(A, [H]));
if (a === false) {
return `RETURN`
};

const [a] = b;
return a;
}
};

C.displayName = "Main";
const [b] = a;
return b
};
15 changes: 0 additions & 15 deletions spec/compilers/block_with_early_return_2

This file was deleted.

50 changes: 18 additions & 32 deletions spec/compilers/block_with_early_return_await
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,25 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class B extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class C extends _C {
render() {
import {
patternVariable as H,
destructure as E,
newVariant as F,
pattern as G,
variant as B
} from "./runtime.js";

export const
A = B(1),
C = B(1),
D = () => {
(async () => {
const b = __match(await _n(A)(`Some string...`), _PE(A,[
_PV
]));

if (b === false) {
const a = E(await F(A)(`Some string...`), G(A, [H]));
if (a === false) {
return `RETURN`
};

const [a] = b;
return a;
const [b] = a;
return b
})();

return ``;
}
};

C.displayName = "Main";
return ``
};
16 changes: 9 additions & 7 deletions spec/compilers/block_with_tuple_destructuring
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ component Main {
}
}
--------------------------------------------------------------------------------
class A extends _C {
render() {
const [a,b] = [`Some string...`, `B`];
return a + `, other string...`;
}
export const A = () => {
const [
a,
b
] = [
`Some string...`,
`B`
];
return a + `, other string...`
};

A.displayName = "Main";
20 changes: 4 additions & 16 deletions spec/compilers/bool_literal_false
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
component Main {
fun test : Bool {
false
}

fun render : String {
test()
false

""
}
}
--------------------------------------------------------------------------------
class A extends _C {
a() {
return false;
}

render() {
this.a();
return ``;
}
export const A = () => {
false;
return ``
};

A.displayName = "Main";
Loading

0 comments on commit e18f241

Please sign in to comment.