File: test-function_args.1.R

package info (click to toggle)
r-cran-lambda.r 1.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 284 kB
  • sloc: sh: 9; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (2)
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
rm(list=ls())

assert('function_args_1', {
  f() %as% 1
  seal(f)
  act <- f()
  (act ==1)
})

assert('function_args_2', {
  f() %::% numeric
  f() %as% 1
  seal(f)
  act <- f()
  (act ==1)
})

assert('function_args_3', {
  f() %::% numeric
  f() %as% 1
  f(a) %::% numeric : numeric
  f(a) %as% a
  seal(f)

  act <- f()
  (act ==1)
  act <- f(3)
  (act ==3)
})

assert('function_args_4', {
  f() %::% numeric
  f() %:=% 1
  f(a) %::% numeric : numeric
  f(a) %:=% a
  seal(f)

  act <- f()
  (act ==1)
  act <- f(3)
  (act ==3)
})