Skip to content

Commit

Permalink
made no parenthesis the default convention for anonymous functions wi…
Browse files Browse the repository at this point in the history
…th no parameters.
  • Loading branch information
mcfriend99 committed Sep 25, 2024
1 parent 8204189 commit c09a14e
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 104 deletions.
4 changes: 2 additions & 2 deletions apps/nyssa/.blade/libs/qi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Now, let's create a test for it by creating a file `prod.test.b` in the `tests`
```py
import ..prod

describe('Product test suite', @() {
it('should return 6 for 2 and 3', @() {
describe('Product test suite', @{
it('should return 6 for 2 and 3', @{
expect(prod(2, 3)).to_be(6)
})
})
Expand Down
22 changes: 11 additions & 11 deletions apps/nyssa/.blade/libs/qi/tests/global.b
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ var myBeverage = {
sour: false,
}

describe('my beverage', @() {
it('should be delicious', @() {
describe('my beverage', @{
it('should be delicious', @{
expect(myBeverage.delicious).to_be_truthy()
});

it('should be sour', @() {
it('should be sour', @{
expect(myBeverage.sour).to_be_falsy()
})
})
Expand All @@ -23,19 +23,19 @@ var binay_string_to_number = @( bin_string ) {
return to_number('0b' + bin_string)
}

describe('binay string to number', @() {
describe('given an invalid binary string', @() {
it('throws CustomError when composed of non-numbers', @() {
expect(@() { binay_string_to_number('abc') }).to_throw(CustomError)
describe('binay string to number', @{
describe('given an invalid binary string', @{
it('throws CustomError when composed of non-numbers', @{
expect(@{ binay_string_to_number('abc') }).to_throw(CustomError)
})

it('throws CustomError when having extra whitespace', @() {
expect(@() { binay_string_to_number(' 100') }).to_throw(CustomError)
it('throws CustomError when having extra whitespace', @{
expect(@{ binay_string_to_number(' 100') }).to_throw(CustomError)
})
})

describe('given a valid binary string', @() {
it('returns the correct number', @() {
describe('given a valid binary string', @{
it('returns the correct number', @{
expect(binay_string_to_number('100')).to_be(4)
})
})
Expand Down
6 changes: 3 additions & 3 deletions apps/nyssa/.blade/libs/qi/tests/sample.spec.b
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
describe('Some testing', @() {
it('should match exactly!', @() {
describe('Some testing', @{
it('should match exactly!', @{
expect(3).to_be(3)
expect(5).to_be(5)
expect(5).not().to_be(56)

class X {}

var b = []
expect(@() { return b[5] }).not().to_throw(X)
expect(@{ return b[5] }).not().to_throw(X)
})
})
6 changes: 3 additions & 3 deletions apps/nyssa/.blade/libs/qi/tests/sample2.spec.b
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
describe('Some testing', @() {
it('should match exactly!', @() {
describe('Some testing', @{
it('should match exactly!', @{
expect(3).to_be(3)
expect(5).to_be(5)

class X {}

var b = []
expect(@() { return b[5] }).to_throw()
expect(@{ return b[5] }).to_throw()
})
})
6 changes: 3 additions & 3 deletions apps/nyssa/.blade/libs/qi/tests/setup.spec.b
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import ..setup

describe('Importing', @() {
it('should have a valid command', @() {
describe('Importing', @{
it('should have a valid command', @{
expect(setup.cmd).to_be_string()
})
it('should have a correct file path', @() {
it('should have a correct file path', @{
expect(setup.path).to_contain('qi')
})
})
24 changes: 12 additions & 12 deletions apps/nyssa/.blade/libs/qi/tests/test.b
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var can = {
ounces: 12,
}

describe('the can', @() {
it('has 12 ounces', @() {
describe('the can', @{
it('has 12 ounces', @{
expect(can.ounces).to_be(12)

class A {
Expand All @@ -17,15 +17,15 @@ describe('the can', @() {
expect(10.5).to_be_number().to_be_less_than(20)
})

it('has a sophisticated name', @() {
it('has a sophisticated name', @{
expect(can.name).to_be('pamplemousse')

expect([1, 2, 3]).to_have_length(3)
expect('abc').to_have_length(3)
expect('').not().to_have_length(5)
})

it('should pass this tests', @() {
it('should pass this tests', @{
class A {
testing() {}
@testing() {}
Expand All @@ -46,30 +46,30 @@ describe('the can', @() {
})

def do_something(id) {
if id == 1 return @() { do_another_thing() }
else return @() { do_something_else() }
if id == 1 return @{ do_another_thing() }
else return @{ do_something_else() }
}

class Set {
@iter() {}
@itern() {}
}

describe('grapefruits', @() {
it('should be a grape', @() {
describe('grapefruits', @{
it('should be a grape', @{
expect('grapefruits').to_match('grape')
expect(do_something(1)).to_be_function()

expect('Hosana').to_be_string()
expect(Exception).to_be_class()
})

it('should be valid type', @() {
it('should be valid type', @{
expect({age: 10}).to_be_dict()
expect(bytes(0)).to_be_bytes()
})

it('should be enumerable', @() {
it('should be enumerable', @{
expect([]).to_be_iterable()
expect({}).to_be_iterable()
expect(Set()).to_be_iterable()
Expand All @@ -85,8 +85,8 @@ def drink_flavor(flavor) {
# Do some other stuff
}

describe('testing to throw', @() {
it('throws on octopus', @() {
describe('testing to throw', @{
it('throws on octopus', @{
def drink_octopus() {
drink_flavor('octopus')
}
Expand Down
4 changes: 2 additions & 2 deletions apps/nyssa/app/server/router.b
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def _setup_session(req, res) {
}

# bind '.clear_session()' to response
res.clear_session = @() {
res.clear_session = @{
res.session = {}

# just for simplicity
return nil
}
}

var _template_setup = @() {
var _template_setup = @{
var tpl = template()
tpl.set_root(os.join_paths(setup.NYSSA_DIR, setup.TEMPLATES_DIR))
for name, fn in template_ext() {
Expand Down
Loading

0 comments on commit c09a14e

Please sign in to comment.