mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 00:11:45 +03:00
Restructure the Standard Library (#1245)
Split std-lib into two libraries: Base and Test.
This commit is contained in:
parent
79b718e28b
commit
36694e2496
4
.github/workflows/scala.yml
vendored
4
.github/workflows/scala.yml
vendored
@ -260,13 +260,13 @@ jobs:
|
||||
shell: bash
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
$ENGINE_DIST_DIR/bin/enso --run test/Test
|
||||
$ENGINE_DIST_DIR/bin/enso --run test/Tests
|
||||
|
||||
- name: Test Engine Distribution (Windows)
|
||||
shell: bash
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
$ENGINE_DIST_DIR/bin/enso.bat --run test/Test
|
||||
$ENGINE_DIST_DIR/bin/enso.bat --run test/Tests
|
||||
|
||||
# Publish
|
||||
- name: Publish the Engine Distribution Artifact
|
||||
|
@ -1,8 +1,8 @@
|
||||
from Base import all
|
||||
import Base.Time.Time
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time_Of_Day
|
||||
import Base.Time.Zone
|
||||
import Base.Data.Time.Time
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time_Of_Day
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
polyglot java import java.time.Instant
|
||||
polyglot java import java.time.LocalDate
|
||||
@ -66,7 +66,7 @@ type Date
|
||||
example, "d MMM yyyy" will format "2011-12-03" as "3 Dec 2011".
|
||||
|
||||
For the list of accepted symbols in pattern refer to
|
||||
`Base.Time.Time.format` doc.
|
||||
`Base.Data.Time.Time.format` doc.
|
||||
|
||||
> Example
|
||||
Format "2020-06-02" as "2 June 2020"
|
||||
@ -122,7 +122,7 @@ parse text =
|
||||
## Obtains an instance of `Date` from a text using custom format.
|
||||
|
||||
For the list of accepted symbols in pattern refer to
|
||||
`Base.Time.Time.format` doc.
|
||||
`Base.Data.Time.Time.format` doc.
|
||||
|
||||
> Example
|
||||
Parse "1999-1-1" as Date.
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Time.Time
|
||||
import Base.Data.Time.Time
|
||||
|
||||
polyglot java import java.time.Duration as Java_Duration
|
||||
polyglot java import java.time.Period as Java_Period
|
@ -1,8 +1,8 @@
|
||||
from Base import all
|
||||
import Base.Time.Date
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time_Of_Day
|
||||
import Base.Time.Zone
|
||||
import Base.Data.Time.Date
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time_Of_Day
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
polyglot java import java.time.ZonedDateTime
|
||||
polyglot java import java.time.format.DateTimeFormatter
|
@ -1,8 +1,8 @@
|
||||
from Base import all
|
||||
import Base.Time.Date
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time
|
||||
import Base.Time.Zone
|
||||
import Base.Data.Time.Date
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
polyglot java import java.time.Instant
|
||||
polyglot java import java.time.LocalTime
|
||||
@ -70,7 +70,7 @@ type Time_Of_Day
|
||||
example, "HH-mm-ss.SSS" will format "16:21:10" as "16-21-10.323".
|
||||
|
||||
For the list of accepted symbols in pattern refer to
|
||||
`Base.Time.Time.format` doc.
|
||||
`Base.Data.Time.Time.format` doc.
|
||||
|
||||
> Example
|
||||
Format "16:21:10" as "16:21:00.1234"
|
||||
@ -130,7 +130,7 @@ parse text =
|
||||
## Obtains an instance of Time_Of_Day from a text using custom format.
|
||||
|
||||
For the list of accepted symbols in pattern refer to
|
||||
`Base.Time.Time.format` doc.
|
||||
`Base.Data.Time.Time.format` doc.
|
||||
|
||||
> Example
|
||||
Parse "04:30:20" as Time_Of_Day.
|
@ -1,26 +1,26 @@
|
||||
import Base.List
|
||||
import Base.Vector
|
||||
import Base.Number.Extensions
|
||||
import Base.Text.Extensions
|
||||
import Base.Data.Number.Extensions
|
||||
import Base.Data.Text.Extensions
|
||||
import Base.Data.List
|
||||
import Base.Data.Vector
|
||||
import Base.System.File
|
||||
import Base.Meta.Enso_Project
|
||||
import Base.Meta.Meta
|
||||
import Base.Meta
|
||||
import Base.Error.Extensions
|
||||
import Base.Polyglot.Java
|
||||
import Base.Data.Map
|
||||
import Base.Data.Json
|
||||
from Builtins import Unit, Number, Integer, Any, True, False, Cons, Boolean
|
||||
|
||||
export Base.Meta.Meta
|
||||
export Base.Meta
|
||||
from Builtins export all hiding Meta
|
||||
|
||||
export Base.Data.Map
|
||||
export Base.Data.Json
|
||||
from Base.Data.Number.Extensions export all hiding Math, String
|
||||
from Base.Data.Text.Extensions export Text
|
||||
from Base.Meta.Enso_Project export all
|
||||
from Base.List export Nil, Cons
|
||||
from Base.Vector export Vector
|
||||
from Base.Number.Extensions export all hiding Math, String
|
||||
from Base.Text.Extensions export Text
|
||||
from Base.Data.List export Nil, Cons
|
||||
from Base.Data.Vector export Vector
|
||||
from Base.Error.Extensions export all
|
||||
from Base.Polyglot.Java export all
|
||||
export Base.System.File
|
||||
|
@ -1,17 +1,17 @@
|
||||
from Base import all
|
||||
import Base.Data.Json
|
||||
import Base.Net.Proxy
|
||||
import Base.Net.Uri
|
||||
import Base.Net.Http.Form
|
||||
import Base.Net.Http.Header
|
||||
import Base.Net.Http.Method
|
||||
import Base.Net.Http.Request
|
||||
import Base.Net.Http.Request.Body as Request_Body
|
||||
import Base.Net.Http.Response
|
||||
import Base.Net.Http.Version
|
||||
import Base.Network.Proxy
|
||||
import Base.Network.Uri
|
||||
import Base.Network.Http.Form
|
||||
import Base.Network.Http.Header
|
||||
import Base.Network.Http.Method
|
||||
import Base.Network.Http.Request
|
||||
import Base.Network.Http.Request.Body as Request_Body
|
||||
import Base.Network.Http.Response
|
||||
import Base.Network.Http.Version
|
||||
import Base.System.File
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time
|
||||
|
||||
polyglot java import java.time.Duration as Java_Duration
|
||||
polyglot java import java.net.InetSocketAddress
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Vector
|
||||
import Base.Data.Vector
|
||||
|
||||
type To_Form
|
||||
|
@ -1,10 +1,9 @@
|
||||
from Base import all
|
||||
import Base.Vector
|
||||
import Base.Net.Uri
|
||||
import Base.Net.Http.Form
|
||||
import Base.Net.Http.Header
|
||||
import Base.Net.Http.Method
|
||||
import Base.Net.Http.Request.Body as Request_Body
|
||||
import Base.Network.Uri
|
||||
import Base.Network.Http.Form
|
||||
import Base.Network.Http.Header
|
||||
import Base.Network.Http.Method
|
||||
import Base.Network.Http.Request.Body as Request_Body
|
||||
import Base.System.File
|
||||
|
||||
polyglot java import org.enso.base.Text_Utils
|
@ -1,9 +1,9 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Net.Http.Header
|
||||
import Base.Net.Http.Response.Body as Response_Body
|
||||
import Base.Net.Http.Status_Code
|
||||
import Base.Vector
|
||||
import Base.Data.Vector
|
||||
import Base.Network.Http.Header
|
||||
import Base.Network.Http.Response.Body as Response_Body
|
||||
import Base.Network.Http.Status_Code
|
||||
|
||||
polyglot java import org.enso.base.Http_Utils
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Base.Process.Exit_Code
|
||||
from Base.Vector import Vector
|
||||
import Base.System.Process.Exit_Code
|
||||
from Base.Data.Vector import Vector
|
||||
from Builtins import Array, System, True, False
|
||||
|
||||
## The builder object that is used to create operating system processes.
|
6
distribution/std-lib/Test/package.yaml
Normal file
6
distribution/std-lib/Test/package.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
license: APLv2
|
||||
name: Test
|
||||
enso-version: default
|
||||
version: "0.0.1"
|
||||
author: "Enso Team <contact@enso.org>"
|
||||
maintainer: "Enso Team <contact@enso.org>"
|
2
distribution/std-lib/Test/src/Main.enso
Normal file
2
distribution/std-lib/Test/src/Main.enso
Normal file
@ -0,0 +1,2 @@
|
||||
import Test.Test
|
||||
from Test.Test export all
|
@ -46,7 +46,7 @@ Unqualified imports are broken up into three main categories:
|
||||
module name, followed by an optional rename part (using the `as` keyword),
|
||||
then the keywords `import all`. For example:
|
||||
```
|
||||
from Base.List as Builtin_List import all
|
||||
from Base.Data.List as Builtin_List import all
|
||||
```
|
||||
2. **Restricted Imports:** These import a specified set of names for use as
|
||||
automatically resolved referent names. They consist of the keyword `from`,
|
||||
@ -54,7 +54,7 @@ Unqualified imports are broken up into three main categories:
|
||||
word `import` followed by a coma-separated list of referent names to be
|
||||
imported. For example:
|
||||
```
|
||||
from Base.List import Cons, Nil
|
||||
from Base.Data.List import Cons, Nil
|
||||
```
|
||||
3. **Hiding Imports:** These are the inverse of restricted imports, and import
|
||||
_all_ symbosl other than the named ones. They consist of the `from` keyword,
|
||||
@ -62,7 +62,7 @@ Unqualified imports are broken up into three main categories:
|
||||
words `import all hiding`, followed by a coma-separated list of referent
|
||||
names to be excluded from the import. For example:
|
||||
```
|
||||
from Base.List import all hiding Cons, Nil
|
||||
from Base.Data.List import all hiding Cons, Nil
|
||||
```
|
||||
|
||||
Imports in Enso _may_ introduce ambiguous symbols, but this is not an error
|
||||
@ -92,7 +92,7 @@ Unqualified exports are broken up into three main categories:
|
||||
module name, followed by an optional rename part (using the `as` keyword),
|
||||
then the keywords `export all`. For example:
|
||||
```
|
||||
from Base.List as Builtin_List export all
|
||||
from Base.Data.List as Builtin_List export all
|
||||
```
|
||||
2. **Restricted Exports:** These export a specified set of names, behaving as
|
||||
though they were redefined in the current scope. They consist of the keyword
|
||||
@ -100,7 +100,7 @@ Unqualified exports are broken up into three main categories:
|
||||
the word `export` followed by a coma-separated list of names to be exported.
|
||||
For example:
|
||||
```
|
||||
from Base.List export Cons, Nil, from_vector
|
||||
from Base.Data.List export Cons, Nil, from_vector
|
||||
```
|
||||
3. **Hiding Exports:** These are the inverse of restricted exports, and export
|
||||
_all_ symbols other than the named ones. They consist of the `from` keyword,
|
||||
@ -108,7 +108,7 @@ Unqualified exports are broken up into three main categories:
|
||||
words `export all hiding`, followed by a coma-separated list of names to be
|
||||
excluded from the export. For example:
|
||||
```
|
||||
from Base.List export all hiding from_vector, Nil
|
||||
from Base.Data.List export all hiding from_vector, Nil
|
||||
```
|
||||
|
||||
In essence, an export allows the user to "paste" the contents of the module
|
||||
|
@ -373,8 +373,8 @@ propose an explicit mechanism for access modification that works as follows:
|
||||
modifier from the file in which you want to access those elements.
|
||||
|
||||
```ruby
|
||||
import private Base.Vector
|
||||
import unsafe Base.Atom
|
||||
import private Base.Data.Vector
|
||||
import unsafe Base.Data.Atom
|
||||
```
|
||||
|
||||
- These modified imports are available in _all_ scopes, so it is possible to
|
||||
@ -382,8 +382,8 @@ propose an explicit mechanism for access modification that works as follows:
|
||||
|
||||
```ruby
|
||||
function_using_modifiers v x =
|
||||
import private Base.Vector
|
||||
import unsafe Base.Atom
|
||||
import private Base.Data.Vector
|
||||
import unsafe Base.Data.Atom
|
||||
|
||||
v.mutate_at_index 0 (_ -> x)
|
||||
x = MyAtom.mutate_field name="sum" (with = x -> x + 20)
|
||||
|
@ -46,8 +46,8 @@ Access modifiers in Enso work as follows:
|
||||
modifier from the file in which you want to access those elements.
|
||||
|
||||
```ruby
|
||||
import private Base.Vector
|
||||
import unsafe Base.Atom
|
||||
import private Base.Data.Vector
|
||||
import unsafe Base.Data.Atom
|
||||
```
|
||||
|
||||
- These modified imports are available in _all_ scopes, so it is possible to
|
||||
@ -55,8 +55,8 @@ Access modifiers in Enso work as follows:
|
||||
|
||||
```ruby
|
||||
function_using_modifiers v x =
|
||||
import private Base.Vector
|
||||
import unsafe Base.Atom
|
||||
import private Base.Data.Vector
|
||||
import unsafe Base.Data.Atom
|
||||
|
||||
v.mutate_at_index 0 (_ -> x)
|
||||
x = MyAtom.mutate_field name="sum" (with = x -> x + 20)
|
||||
|
@ -5413,7 +5413,7 @@ object IR {
|
||||
case object UnresolvedSequenceMacro extends Reason {
|
||||
override def explain(originalName: Name): String =
|
||||
"No definition for the sequence macro could be found. Try" +
|
||||
" importing the default definition from the Base.Vector module."
|
||||
" importing the default definition from the Base.Data.Vector module."
|
||||
}
|
||||
|
||||
/** An error coming from an unknown annotation name.
|
||||
|
@ -74,7 +74,7 @@ case object VectorLiterals extends IRPass {
|
||||
.resolvedExports
|
||||
.map(_.module)
|
||||
)
|
||||
.find(_.getName.toString == "Base.Vector")
|
||||
.find(_.getName.toString == "Base.Data.Vector")
|
||||
val name = IR.Name.Literal("<Sequence Macro>", isReferent = true, None)
|
||||
module
|
||||
.map { module =>
|
||||
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
import Builtins
|
||||
import Base.Bench_Utils
|
||||
import Test.Bench
|
||||
|
||||
polyglot java import java.util.Random
|
||||
|
||||
@ -27,8 +27,8 @@ main =
|
||||
list = here.gen_list mil
|
||||
vec = Vector.new mil (ix -> ix + 1)
|
||||
vec_decimal = Vector.new mil (ix -> ix + 0.0)
|
||||
Bench_Utils.measure (here.sum_list_meta list) "list meta-fold" 1000 10
|
||||
Bench_Utils.measure (list.fold 0 (+)) "list fold" 1000 10
|
||||
Bench_Utils.measure (vec.fold 0 (+)) "vector fold" 1000 10
|
||||
Bench_Utils.measure (vec_decimal.fold 0 (+)) "vector decimal fold" 1000 10
|
||||
Bench_Utils.measure (here.build_map 10000) "build a map" 100 10
|
||||
Bench.measure (here.sum_list_meta list) "list meta-fold" 1000 10
|
||||
Bench.measure (list.fold 0 (+)) "list fold" 1000 10
|
||||
Bench.measure (vec.fold 0 (+)) "vector fold" 1000 10
|
||||
Bench.measure (vec_decimal.fold 0 (+)) "vector decimal fold" 1000 10
|
||||
Bench.measure (here.build_map 10000) "build a map" 100 10
|
||||
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Bench_Utils
|
||||
import Test.Bench
|
||||
|
||||
prep_json size =
|
||||
single = '{"foo": 543}, {"bar": false}'
|
||||
@ -10,4 +10,4 @@ prep_json size =
|
||||
|
||||
main =
|
||||
large_json = here.prep_json 1000000
|
||||
Bench_Utils.measure (Base.Json.parse large_json) "parse json" 10 10
|
||||
Bench.measure (Base.Json.parse large_json) "parse json" 10 10
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Base.Bench_Utils
|
||||
import Test.Bench
|
||||
from Base import all
|
||||
|
||||
polyglot java import java.lang.Long
|
||||
@ -69,17 +69,17 @@ sum_co n =
|
||||
main =
|
||||
hundred_mil = 100000000
|
||||
IO.println "Measuring Sum TCO Corecursive"
|
||||
Bench_Utils.measure (here.sum_co hundred_mil) "sum_tco_corecursive" 100 10
|
||||
Bench.measure (here.sum_co hundred_mil) "sum_tco_corecursive" 100 10
|
||||
IO.println "Measuring Sum TCO Decimal"
|
||||
Bench_Utils.measure (here.sum_tco_decimal hundred_mil) "sum_tco_float" 100 10
|
||||
Bench.measure (here.sum_tco_decimal hundred_mil) "sum_tco_float" 100 10
|
||||
IO.println "Measuring SumTCO"
|
||||
Bench_Utils.measure (here.sum_tco hundred_mil) "sum_tco" 100 10
|
||||
Bench.measure (here.sum_tco hundred_mil) "sum_tco" 100 10
|
||||
IO.println "Measuring SumTCO Java"
|
||||
Bench_Utils.measure (here.sum_tco_java hundred_mil) "sum_tco_java" 100 10
|
||||
Bench.measure (here.sum_tco_java hundred_mil) "sum_tco_java" 100 10
|
||||
IO.println "Measuring SumTCO Eval"
|
||||
Bench_Utils.measure (here.sum_tco_eval hundred_mil) "sum_tco_eval" 100 10
|
||||
Bench.measure (here.sum_tco_eval hundred_mil) "sum_tco_eval" 100 10
|
||||
IO.println "Measuring State"
|
||||
Bench_Utils.measure (here.sum_state hundred_mil) "sum_state" 100 10
|
||||
Bench.measure (here.sum_state hundred_mil) "sum_state" 100 10
|
||||
IO.println "Measuring Co-State"
|
||||
Bench_Utils.measure (here.sum_co_state hundred_mil) "sum_co_state" 100 10
|
||||
Bench.measure (here.sum_co_state hundred_mil) "sum_co_state" 100 10
|
||||
IO.println "Bye."
|
||||
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
from Builtins import Prim_Text_Helper
|
||||
import Base.Bench_Utils
|
||||
import Test.Bench
|
||||
|
||||
polyglot java import java.lang.StringBuilder
|
||||
|
||||
@ -16,6 +16,6 @@ build_long_bldr n =
|
||||
res
|
||||
|
||||
main =
|
||||
Bench_Utils.measure (here.build_long_bldr 1000000) "string append bldr" 100 10
|
||||
Bench_Utils.measure (here.build_long 1000000) "string append" 100 10
|
||||
Bench.measure (here.build_long_bldr 1000000) "string append bldr" 100 10
|
||||
Bench.measure (here.build_long 1000000) "string append" 100 10
|
||||
IO.println "Bye"
|
||||
|
@ -1,45 +0,0 @@
|
||||
import Base.Test
|
||||
|
||||
import Test.Semantic.Import_Loop.Spec as Import_Loop_Spec
|
||||
import Test.Semantic.Deep_Export.Spec as Deep_Export_Spec
|
||||
import Test.Semantic.Java_Interop_Spec
|
||||
import Test.Semantic.Error_Spec
|
||||
import Test.Semantic.Names_Spec
|
||||
import Test.Semantic.Meta_Spec
|
||||
|
||||
import Test.List_Spec
|
||||
import Test.Data.Map_Spec
|
||||
import Test.Data.Json_Spec
|
||||
import Test.Number_Spec
|
||||
import Test.Process_Spec
|
||||
import Test.Vector.Spec as Vector_Spec
|
||||
import Test.Net.Http_Spec
|
||||
import Test.Net.Uri_Spec
|
||||
import Test.Net.Http.Header_Spec
|
||||
import Test.Net.Http.Request_Spec
|
||||
import Test.Numbers.Spec as Numbers_Spec
|
||||
import Test.Text.Spec as Text_Spec
|
||||
import Test.Time.Spec as Time_Spec
|
||||
import Test.System.File_Spec
|
||||
|
||||
main = Test.Suite.runMain <|
|
||||
List_Spec.spec
|
||||
Number_Spec.spec
|
||||
Import_Loop_Spec.spec
|
||||
Names_Spec.spec
|
||||
Error_Spec.spec
|
||||
Deep_Export_Spec.spec
|
||||
Process_Spec.spec
|
||||
Java_Interop_Spec.spec
|
||||
Vector_Spec.spec
|
||||
Numbers_Spec.spec
|
||||
Text_Spec.spec
|
||||
Time_Spec.spec
|
||||
File_Spec.spec
|
||||
Meta_Spec.spec
|
||||
Map_Spec.spec
|
||||
Json_Spec.spec
|
||||
Uri_Spec.spec
|
||||
Header_Spec.spec
|
||||
Request_Spec.spec
|
||||
Http_Spec.spec
|
@ -1,7 +0,0 @@
|
||||
import Base.Test
|
||||
|
||||
spec = describe "Number" <|
|
||||
it "should define addition" <|
|
||||
2+3 . should_equal 5
|
||||
it "should define multiplication" <|
|
||||
2*3 . should_equal 6
|
@ -1,3 +0,0 @@
|
||||
from Test.Semantic.Deep_Export.Internal_1 import Const
|
||||
|
||||
my_fun = Const
|
@ -1,3 +0,0 @@
|
||||
from Test.Semantic.Deep_Export.Internal_2 import Const
|
||||
|
||||
from Test.Semantic.Deep_Export.Internal_2 export Const
|
@ -1,3 +0,0 @@
|
||||
import Test.Semantic.Deep_Export.Internal_3
|
||||
|
||||
const = Internal_3.util.const + 5.bar
|
@ -1,3 +0,0 @@
|
||||
from Test.Semantic.Deep_Export.Internal_4 import Internal_5
|
||||
|
||||
export Test.Semantic.Deep_Export.Internal_4 as Util
|
@ -1,3 +0,0 @@
|
||||
import Test.Semantic.Deep_Export.Internal_5
|
||||
|
||||
from Test.Semantic.Deep_Export.Internal_5 export Const
|
@ -1,3 +0,0 @@
|
||||
from Test.Semantic.Import_Loop.B import My_Type
|
||||
|
||||
foo = My_Type.bar 10
|
@ -1,15 +0,0 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
|
||||
import Test.Time.Duration_Spec
|
||||
import Test.Time.Time_Of_Day_Spec
|
||||
import Test.Time.Date_Spec
|
||||
import Test.Time.Time_Spec
|
||||
import Test.Time.Zone_Spec
|
||||
|
||||
spec =
|
||||
Zone_Spec.spec
|
||||
Time_Of_Day_Spec.spec
|
||||
Date_Spec.spec
|
||||
Time_Spec.spec
|
||||
Duration_Spec.spec
|
@ -1,4 +1,4 @@
|
||||
name: Test
|
||||
name: Tests
|
||||
enso-version: default
|
||||
version: 0.0.1
|
||||
license: MIT
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
type Author name year_of_birth
|
||||
type Book title author
|
@ -1,4 +1,4 @@
|
||||
import Base.Test
|
||||
import Test
|
||||
from Base import all
|
||||
|
||||
spec = describe "List" <|
|
||||
@ -28,4 +28,3 @@ spec = describe "List" <|
|
||||
any_eq_five = l.any (== 5)
|
||||
any_even.should_be_true
|
||||
any_eq_five.should_be_false
|
||||
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
spec = describe "Maps" <|
|
||||
it "should allow inserting and looking up values" <|
|
@ -1,6 +1,6 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
Integer.is_even = this % 2 == 0
|
||||
Decimal.get_fun_factor = "Wow, " + this.to_text + " is such a fun number!"
|
||||
@ -45,6 +45,10 @@ spec =
|
||||
it "should allow defining extension methods through the Decimal type" <|
|
||||
32.5.get_fun_factor.should_equal "Wow, 32.5 is such a fun number!"
|
||||
describe "Numbers" <|
|
||||
it "should define addition" <|
|
||||
2+3 . should_equal 5
|
||||
it "should define multiplication" <|
|
||||
2*3 . should_equal 6
|
||||
it "should expose comparison operators" <|
|
||||
(3 < hundred_factorial).should_be_true
|
||||
(hundred_factorial < 3).should_be_false
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
type Auto a
|
||||
|
@ -1,11 +1,11 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Time.Date
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time
|
||||
import Base.Time.Time_Of_Day
|
||||
import Base.Time.Zone
|
||||
import Test
|
||||
import Base.Data.Time.Date
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time
|
||||
import Base.Data.Time.Time_Of_Day
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
spec =
|
||||
describe "Date" <|
|
@ -1,8 +1,8 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time
|
||||
import Test
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time
|
||||
|
||||
spec =
|
||||
describe "Duration" <|
|
14
test/Tests/src/Data/Time/Spec.enso
Normal file
14
test/Tests/src/Data/Time/Spec.enso
Normal file
@ -0,0 +1,14 @@
|
||||
from Base import all
|
||||
|
||||
import Tests.Data.Time.Duration_Spec
|
||||
import Tests.Data.Time.Time_Of_Day_Spec
|
||||
import Tests.Data.Time.Date_Spec
|
||||
import Tests.Data.Time.Time_Spec
|
||||
import Tests.Data.Time.Zone_Spec
|
||||
|
||||
spec =
|
||||
Zone_Spec.spec
|
||||
Time_Of_Day_Spec.spec
|
||||
Date_Spec.spec
|
||||
Time_Spec.spec
|
||||
Duration_Spec.spec
|
@ -1,11 +1,11 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Time.Date
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Time
|
||||
import Base.Time.Time_Of_Day
|
||||
import Base.Time.Zone
|
||||
import Test
|
||||
import Base.Data.Time.Date
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Time
|
||||
import Base.Data.Time.Time_Of_Day
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
spec =
|
||||
describe "Time_Of_Day" <|
|
@ -1,9 +1,9 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Time.Time
|
||||
import Base.Time.Duration
|
||||
import Base.Time.Zone
|
||||
import Test
|
||||
import Base.Data.Time.Time
|
||||
import Base.Data.Time.Duration
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
spec =
|
||||
describe "Time" <|
|
@ -1,7 +1,7 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Time.Zone
|
||||
import Test
|
||||
import Base.Data.Time.Zone
|
||||
|
||||
spec =
|
||||
describe "Zone" <|
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
spec = describe "Vectors" <|
|
||||
it "should allow accessing elements" <|
|
43
test/Tests/src/Main.enso
Normal file
43
test/Tests/src/Main.enso
Normal file
@ -0,0 +1,43 @@
|
||||
import Test
|
||||
|
||||
import Tests.Semantic.Import_Loop.Spec as Import_Loop_Spec
|
||||
import Tests.Semantic.Deep_Export.Spec as Deep_Export_Spec
|
||||
import Tests.Semantic.Java_Interop_Spec
|
||||
import Tests.Semantic.Error_Spec
|
||||
import Tests.Semantic.Names_Spec
|
||||
import Tests.Semantic.Meta_Spec
|
||||
|
||||
import Tests.Data.Json_Spec
|
||||
import Tests.Data.List_Spec
|
||||
import Tests.Data.Map_Spec
|
||||
import Tests.Data.Numbers_Spec
|
||||
import Tests.Data.Text_Spec
|
||||
import Tests.Data.Time.Spec as Time_Spec
|
||||
import Tests.Data.Vector_Spec
|
||||
import Tests.Network.Http_Spec
|
||||
import Tests.Network.Uri_Spec
|
||||
import Tests.Network.Http.Header_Spec
|
||||
import Tests.Network.Http.Request_Spec
|
||||
import Tests.System.File_Spec
|
||||
import Tests.System.Process_Spec
|
||||
|
||||
main = Test.Suite.runMain <|
|
||||
List_Spec.spec
|
||||
Numbers_Spec.spec
|
||||
Import_Loop_Spec.spec
|
||||
Names_Spec.spec
|
||||
Error_Spec.spec
|
||||
Deep_Export_Spec.spec
|
||||
Process_Spec.spec
|
||||
Java_Interop_Spec.spec
|
||||
Vector_Spec.spec
|
||||
Text_Spec.spec
|
||||
Time_Spec.spec
|
||||
File_Spec.spec
|
||||
Meta_Spec.spec
|
||||
Map_Spec.spec
|
||||
Json_Spec.spec
|
||||
Uri_Spec.spec
|
||||
Header_Spec.spec
|
||||
Request_Spec.spec
|
||||
Http_Spec.spec
|
@ -1,7 +1,7 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Net.Http.Header
|
||||
import Test
|
||||
import Base.Network.Http.Header
|
||||
|
||||
spec =
|
||||
describe "Header" <|
|
@ -1,12 +1,12 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Net.Http.Form
|
||||
import Base.Net.Http.Header
|
||||
import Base.Net.Http.Method
|
||||
import Base.Net.Http.Request
|
||||
import Base.Net.Http.Request.Body as Request_Body
|
||||
import Base.Net.Uri
|
||||
import Test
|
||||
import Base.Network.Http.Form
|
||||
import Base.Network.Http.Header
|
||||
import Base.Network.Http.Method
|
||||
import Base.Network.Http.Request
|
||||
import Base.Network.Http.Request.Body as Request_Body
|
||||
import Base.Network.Uri
|
||||
|
||||
spec =
|
||||
test_uri = Uri.parse "https://httpbin.org/post"
|
@ -1,18 +1,18 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Data.Json
|
||||
import Base.Test
|
||||
import Base.Net.Http
|
||||
import Base.Net.Http.Form
|
||||
import Base.Net.Http.Header
|
||||
import Base.Net.Http.Request
|
||||
import Base.Net.Http.Request.Body as Request_Body
|
||||
import Base.Net.Http.Status_Code
|
||||
import Base.Net.Http.Version
|
||||
import Base.Net.Proxy
|
||||
import Base.Net.Uri
|
||||
import Test
|
||||
import Base.Network.Http
|
||||
import Base.Network.Http.Form
|
||||
import Base.Network.Http.Header
|
||||
import Base.Network.Http.Request
|
||||
import Base.Network.Http.Request.Body as Request_Body
|
||||
import Base.Network.Http.Status_Code
|
||||
import Base.Network.Http.Version
|
||||
import Base.Network.Proxy
|
||||
import Base.Network.Uri
|
||||
import Base.System.File
|
||||
import Base.Time.Duration
|
||||
import Base.Data.Time.Duration
|
||||
|
||||
polyglot java import java.lang.System
|
||||
polyglot java import java.util.Objects
|
@ -1,7 +1,7 @@
|
||||
from Base import all
|
||||
|
||||
import Base.Test
|
||||
import Base.Net.Uri
|
||||
import Test
|
||||
import Base.Network.Uri
|
||||
|
||||
spec =
|
||||
describe "Uri" <|
|
3
test/Tests/src/Semantic/Deep_Export/Internal.enso
Normal file
3
test/Tests/src/Semantic/Deep_Export/Internal.enso
Normal file
@ -0,0 +1,3 @@
|
||||
from Tests.Semantic.Deep_Export.Internal_1 import Const
|
||||
|
||||
my_fun = Const
|
3
test/Tests/src/Semantic/Deep_Export/Internal_1.enso
Normal file
3
test/Tests/src/Semantic/Deep_Export/Internal_1.enso
Normal file
@ -0,0 +1,3 @@
|
||||
from Tests.Semantic.Deep_Export.Internal_2 import Const
|
||||
|
||||
from Tests.Semantic.Deep_Export.Internal_2 export Const
|
3
test/Tests/src/Semantic/Deep_Export/Internal_2.enso
Normal file
3
test/Tests/src/Semantic/Deep_Export/Internal_2.enso
Normal file
@ -0,0 +1,3 @@
|
||||
import Tests.Semantic.Deep_Export.Internal_3
|
||||
|
||||
const = Internal_3.util.const + 5.bar
|
3
test/Tests/src/Semantic/Deep_Export/Internal_3.enso
Normal file
3
test/Tests/src/Semantic/Deep_Export/Internal_3.enso
Normal file
@ -0,0 +1,3 @@
|
||||
from Tests.Semantic.Deep_Export.Internal_4 import Internal_5
|
||||
|
||||
export Tests.Semantic.Deep_Export.Internal_4 as Util
|
3
test/Tests/src/Semantic/Deep_Export/Internal_4.enso
Normal file
3
test/Tests/src/Semantic/Deep_Export/Internal_4.enso
Normal file
@ -0,0 +1,3 @@
|
||||
import Tests.Semantic.Deep_Export.Internal_5
|
||||
|
||||
from Tests.Semantic.Deep_Export.Internal_5 export Const
|
@ -1,8 +1,7 @@
|
||||
import Base.Test
|
||||
import Test.Semantic.Deep_Export.Internal
|
||||
import Test
|
||||
import Tests.Semantic.Deep_Export.Internal
|
||||
|
||||
spec =
|
||||
describe "Deep Exports" <|
|
||||
it "should allow to re-export a symbol through a module hierarchy" <|
|
||||
Internal.my_fun.should_equal 478
|
||||
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
type My_Type foo
|
||||
|
||||
@ -18,4 +18,3 @@ spec =
|
||||
|
||||
err_3.target.to_text.should_equal "(My_Type False)"
|
||||
err_3.method_name.should_equal "nope"
|
||||
|
3
test/Tests/src/Semantic/Import_Loop/A.enso
Normal file
3
test/Tests/src/Semantic/Import_Loop/A.enso
Normal file
@ -0,0 +1,3 @@
|
||||
from Tests.Semantic.Import_Loop.B import My_Type
|
||||
|
||||
foo = My_Type.bar 10
|
@ -1,4 +1,4 @@
|
||||
import Test.Semantic.Import_Loop.A
|
||||
import Tests.Semantic.Import_Loop.A
|
||||
|
||||
type My_Type
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Base.Test
|
||||
import Test.Semantic.Import_Loop.B
|
||||
import Test
|
||||
import Tests.Semantic.Import_Loop.B
|
||||
|
||||
spec = describe "Looping Imports" <|
|
||||
it "should behave correctly and not loop the compiler" <|
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
polyglot java import java.lang.Long
|
||||
polyglot java import java.lang.Integer
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
type My_Type foo bar baz
|
||||
|
@ -1,5 +1,5 @@
|
||||
from Test.Names.Definitions import My_Type, Another_Constant
|
||||
import Base.Test
|
||||
from Tests.Names.Definitions import My_Type, Another_Constant
|
||||
import Test
|
||||
|
||||
Definitions.Foo.my_method = case this of
|
||||
Definitions.Foo x y z -> x * y * z
|
@ -1,5 +1,5 @@
|
||||
from Base import all
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
spec =
|
||||
sample_file = Enso_Project.data / "sample.txt"
|
||||
@ -54,4 +54,3 @@ spec =
|
||||
f.read.should_equal 'line 1!\nline 2!'
|
||||
f.delete
|
||||
f.exists.should_be_false
|
||||
|
@ -1,8 +1,8 @@
|
||||
from Base import all
|
||||
import Base.Process
|
||||
from Base.Process.Exit_Code import Exit_Success, Exit_Failure
|
||||
import Base.System.Process
|
||||
from Base.System.Process.Exit_Code import Exit_Success, Exit_Failure
|
||||
import Base.System.Platform
|
||||
import Base.Test
|
||||
import Test
|
||||
|
||||
spec = describe "Process" <|
|
||||
it "should call simple command" <|
|
Loading…
Reference in New Issue
Block a user