-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce a micro stdlib for testing (#3531)
This introduces a tiny alternative to our stdlib, that can be used for testing the interpreter. There are 2 main advantages of such a solution: 1. Performance: on my machine, `runtime-with-intstruments/test` drops from 146s to 65s, while `runtime/test` drops from 165s to 51s. >6 mins total becoming <2 mins total is awesome. This alone means I'll drink less coffee in these breaks and will be healthier. 2. Better separation of concepts – currently working on a feature that breaks _all_ enso code. The dependency of interpreter tests on the stdlib means I have no means of incremental testing – ALL of stdlib must compile. This is horrible, rendered my work impossible, and resulted in this PR.
- Loading branch information
Showing
34 changed files
with
218 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
engine-version: 0.0.0-dev | ||
repositories: | ||
- name: main | ||
url: https://libraries.release.enso.org/libraries | ||
libraries: | ||
- name: Standard.Base | ||
repository: main | ||
version: 0.0.0-dev |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/manifest.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
archives: | ||
- main.tgz | ||
dependencies: [] |
10 changes: 10 additions & 0 deletions
10
test/micro-distribution/lib/Standard/Base/0.0.0-dev/package.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Base | ||
namespace: Standard | ||
version: 0.0.0-dev | ||
license: APLv2 | ||
authors: | ||
- name: Enso Team | ||
email: [email protected] | ||
maintainers: | ||
- name: Enso Team | ||
email: [email protected] |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Any.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Any | ||
@Builtin_Type | ||
type Any |
7 changes: 7 additions & 0 deletions
7
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type Array | ||
@Builtin_Type | ||
type Array | ||
|
||
new_1 item_1 = @Builtin_Method "Array.new_1" | ||
new_2 item_1 item_2 = @Builtin_Method "Array.new_2" | ||
empty = @Builtin_Method "Array.empty" |
11 changes: 11 additions & 0 deletions
11
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Boolean.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type Boolean | ||
@Builtin_Type | ||
type Boolean | ||
|
||
if_then_else ~on_true ~on_false = @Builtin_Method "Boolean.if_then_else" | ||
|
||
@Builtin_Type | ||
type True | ||
|
||
@Builtin_Type | ||
type False |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/List.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type List | ||
type Nil | ||
type Cons x xs |
7 changes: 7 additions & 0 deletions
7
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Numbers.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type Number | ||
@Builtin_Type | ||
type Number | ||
|
||
type Integer | ||
@Builtin_Type | ||
type Integer |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Text | ||
@Builtin_Type | ||
type Text |
11 changes: 11 additions & 0 deletions
11
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
polyglot java import java.time.LocalDate | ||
polyglot java import java.time.format.DateTimeFormatter | ||
|
||
new year (month = 1) (day = 1) = LocalDate.of year month day | ||
|
||
type Date | ||
type Date internal_local_date | ||
year = this . internal_local_date . getYear | ||
month = this . internal_local_date . getMonthValue | ||
day = this . internal_local_date . getDayOfMonth | ||
to_text = DateTimeFormatter.ISO_LOCAL_DATE.format this.internal_local_date |
27 changes: 27 additions & 0 deletions
27
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Error/Common.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
type Panic | ||
@Builtin_Type | ||
type Panic | ||
throw payload = @Builtin_Method "Panic.throw" | ||
catch_primitive ~action handler = @Builtin_Method "Panic.catch_primitive" | ||
|
||
@Builtin_Type | ||
type Syntax_Error message | ||
@Builtin_Type | ||
type Polyglot_Error cause | ||
@Builtin_Type | ||
type Arithmetic_Error message | ||
@Builtin_Type | ||
type Type_Error expected actual name | ||
@Builtin_Type | ||
type Compile_Error message | ||
@Builtin_Type | ||
type Inexhaustive_Pattern_Match_Error scrutinee | ||
@Builtin_Type | ||
type Arity_Error expected_min expected_max actual | ||
|
||
type Error | ||
@Builtin_Type | ||
type Error | ||
throw payload = @Builtin_Method "Error.throw" | ||
catch_primitive handler = @Builtin_Method "Error.catch_primitive" | ||
catch (handler = x->x) = this.catch_primitive handler |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/IO.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
print_err message = @Builtin_Method "IO.print_err" | ||
println message = @Builtin_Method "IO.println" | ||
readln = @Builtin_Method "IO.readln" |
20 changes: 20 additions & 0 deletions
20
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import project.IO | ||
export project.IO | ||
|
||
import project.Data.List | ||
from project.Data.List export Nil, Cons, List | ||
|
||
import project.Polyglot | ||
from project.Polyglot export all | ||
|
||
export project.Polyglot.Java | ||
import project.Polyglot.Java | ||
|
||
import project.Data.Array | ||
from project.Data.Array export Array | ||
|
||
import project.Error.Common | ||
from project.Error.Common export all | ||
|
||
import project.Data.Numbers | ||
from project.Data.Numbers export Number |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Nothing | ||
@Builtin_Type | ||
type Nothing |
13 changes: 13 additions & 0 deletions
13
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Polyglot.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
type Polyglot | ||
@Builtin_Type | ||
type Polyglot | ||
get_array_size array = @Builtin_Method "Polyglot.get_array_size" | ||
execute callable arguments = @Builtin_Method "Polyglot.execute" | ||
get_member object member_name = @Builtin_Method "Polyglot.get_member" | ||
get_members object = @Builtin_Method "Polyglot.get_members" | ||
new constructor arguments = @Builtin_Method "Polyglot.new" | ||
invoke target name arguments = @Builtin_Method "Polyglot.invoke" | ||
has_source_location value = @Builtin_Method "Polyglot.has_source_location" | ||
get_source_location value = @Builtin_Method "Polyglot.get_source_location" | ||
is_language_installed language_name = @Builtin_Method "Polyglot.is_language_installed" | ||
get_executable_name = @Builtin_Method "Polyglot.get_executable_name" |
1 change: 1 addition & 0 deletions
1
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Polyglot/Java.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lookup_class name = @Builtin_Method "Java.lookup_class" |
2 changes: 2 additions & 0 deletions
2
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Debug.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eval expression = @Builtin_Method "Debug.eval" | ||
breakpoint = @Builtin_Method "Debug.breakpoint" |
10 changes: 10 additions & 0 deletions
10
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Resource.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
bracket : Any -> (Any -> Nothing) -> (Any -> Any) -> Any | ||
bracket ~constructor ~destructor ~action = @Builtin_Method "Resource.bracket" | ||
|
||
type Managed_Resource | ||
@Builtin_Type | ||
type Managed_Resource | ||
register resource function = @Builtin_Method "Managed_Resource.register" | ||
finalize = @Builtin_Method "Managed_Resource.finalize" | ||
with ~action = @Builtin_Method "Managed_Resource.with" | ||
take = @Builtin_Method "Managed_Resource.take" |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/State.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
run key local_state ~computation = @Builtin_Method "State.run" | ||
get key = @Builtin_Method "State.get" | ||
put key new_state = @Builtin_Method "State.put" |
1 change: 1 addition & 0 deletions
1
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Thread.enso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
with_interrupt_handler ~action ~interrupt_handler = @Builtin_Method "Thread.with_interrupt_handler" |
Oops, something went wrong.