Armani Ferrante 4 éve
szülő
commit
5d8b4765f2
100 módosított fájl, 42 hozzáadás és 41 törlés
  1. 2 0
      .gitignore
  2. 5 5
      .gitmodules
  3. 26 26
      .travis.yml
  4. 3 3
      Cargo.toml
  5. 2 2
      client/example/Cargo.toml
  6. 2 2
      client/example/run-test.sh
  7. 2 3
      tests/README.md
  8. 0 0
      tests/cashiers-check/Anchor.toml
  9. 0 0
      tests/cashiers-check/Cargo.toml
  10. 0 0
      tests/cashiers-check/migrations/deploy.js
  11. 0 0
      tests/cashiers-check/programs/cashiers-check/Cargo.toml
  12. 0 0
      tests/cashiers-check/programs/cashiers-check/Xargo.toml
  13. 0 0
      tests/cashiers-check/programs/cashiers-check/src/lib.rs
  14. 0 0
      tests/cashiers-check/tests/cashiers-check.js
  15. 0 0
      tests/cfo/Anchor.toml
  16. 0 0
      tests/cfo/Cargo.toml
  17. 0 0
      tests/cfo/deps/serum-dex
  18. 0 0
      tests/cfo/deps/stake
  19. 0 0
      tests/cfo/deps/swap
  20. 0 0
      tests/cfo/migrations/deploy.js
  21. 0 0
      tests/cfo/programs/cfo/Cargo.toml
  22. 0 0
      tests/cfo/programs/cfo/Xargo.toml
  23. 0 0
      tests/cfo/programs/cfo/src/lib.rs
  24. 0 0
      tests/cfo/scripts/common.sh
  25. 0 0
      tests/cfo/scripts/fees.js
  26. 0 0
      tests/cfo/scripts/list-market.js
  27. 0 0
      tests/cfo/scripts/localnet.sh
  28. 0 0
      tests/cfo/scripts/market-maker.json
  29. 0 0
      tests/cfo/scripts/trade-bot.js
  30. 0 0
      tests/cfo/tests/cfo.js
  31. 0 0
      tests/cfo/tests/utils/index.js
  32. 0 0
      tests/cfo/tests/utils/stake.js
  33. 0 0
      tests/chat/Anchor.toml
  34. 0 0
      tests/chat/Cargo.toml
  35. 0 0
      tests/chat/migrations/deploy.js
  36. 0 0
      tests/chat/programs/chat/Cargo.toml
  37. 0 0
      tests/chat/programs/chat/Xargo.toml
  38. 0 0
      tests/chat/programs/chat/src/lib.rs
  39. 0 0
      tests/chat/tests/chat.js
  40. 0 0
      tests/composite/Anchor.toml
  41. 0 0
      tests/composite/Cargo.toml
  42. 0 0
      tests/composite/programs/composite/Cargo.toml
  43. 0 0
      tests/composite/programs/composite/Xargo.toml
  44. 0 0
      tests/composite/programs/composite/src/lib.rs
  45. 0 0
      tests/composite/tests/composite.js
  46. 0 0
      tests/errors/Anchor.toml
  47. 0 0
      tests/errors/Cargo.toml
  48. 0 0
      tests/errors/programs/errors/Cargo.toml
  49. 0 0
      tests/errors/programs/errors/Xargo.toml
  50. 0 0
      tests/errors/programs/errors/src/lib.rs
  51. 0 0
      tests/errors/tests/errors.js
  52. 0 0
      tests/escrow/Anchor.toml
  53. 0 0
      tests/escrow/Cargo.toml
  54. 0 0
      tests/escrow/package.json
  55. 0 0
      tests/escrow/programs/escrow/Cargo.toml
  56. 0 0
      tests/escrow/programs/escrow/Xargo.toml
  57. 0 0
      tests/escrow/programs/escrow/src/lib.rs
  58. 0 0
      tests/escrow/tests/escrow.js
  59. 0 0
      tests/events/Anchor.toml
  60. 0 0
      tests/events/Cargo.toml
  61. 0 0
      tests/events/migrations/deploy.js
  62. 0 0
      tests/events/programs/events/Cargo.toml
  63. 0 0
      tests/events/programs/events/Xargo.toml
  64. 0 0
      tests/events/programs/events/src/lib.rs
  65. 0 0
      tests/events/tests/events.js
  66. 0 0
      tests/ido-pool/Anchor.toml
  67. 0 0
      tests/ido-pool/Cargo.toml
  68. 0 0
      tests/ido-pool/migrations/deploy.js
  69. 0 0
      tests/ido-pool/programs/ido-pool/Cargo.toml
  70. 0 0
      tests/ido-pool/programs/ido-pool/Xargo.toml
  71. 0 0
      tests/ido-pool/programs/ido-pool/src/lib.rs
  72. 0 0
      tests/ido-pool/tests/ido-pool.js
  73. 0 0
      tests/ido-pool/tests/utils/index.js
  74. 0 0
      tests/interface/Anchor.toml
  75. 0 0
      tests/interface/Cargo.toml
  76. 0 0
      tests/interface/programs/counter-auth/Cargo.toml
  77. 0 0
      tests/interface/programs/counter-auth/Xargo.toml
  78. 0 0
      tests/interface/programs/counter-auth/src/lib.rs
  79. 0 0
      tests/interface/programs/counter/Cargo.toml
  80. 0 0
      tests/interface/programs/counter/Xargo.toml
  81. 0 0
      tests/interface/programs/counter/src/lib.rs
  82. 0 0
      tests/interface/tests/interface.js
  83. 0 0
      tests/lockup/Anchor.toml
  84. 0 0
      tests/lockup/Cargo.toml
  85. 0 0
      tests/lockup/docs/lockups.md
  86. 0 0
      tests/lockup/docs/staking.md
  87. 0 0
      tests/lockup/migrations/deploy.js
  88. 0 0
      tests/lockup/programs/lockup/Cargo.toml
  89. 0 0
      tests/lockup/programs/lockup/Xargo.toml
  90. 0 0
      tests/lockup/programs/lockup/src/calculator.rs
  91. 0 0
      tests/lockup/programs/lockup/src/lib.rs
  92. 0 0
      tests/lockup/programs/registry/Cargo.toml
  93. 0 0
      tests/lockup/programs/registry/Xargo.toml
  94. 0 0
      tests/lockup/programs/registry/src/lib.rs
  95. 0 0
      tests/lockup/tests/lockup.js
  96. 0 0
      tests/lockup/tests/utils.js
  97. 0 0
      tests/misc/Anchor.toml
  98. 0 0
      tests/misc/Cargo.toml
  99. 0 0
      tests/misc/migrations/deploy.js
  100. 0 0
      tests/misc/package.json

+ 2 - 0
.gitignore

@@ -10,6 +10,8 @@ target/
 test-ledger
 examples/*/Cargo.lock
 examples/**/Cargo.lock
+tests/*/Cargo.lock
+tests/**/Cargo.lock
 .DS_Store
 docs/yarn.lock
 ts/docs/

+ 5 - 5
.gitmodules

@@ -1,15 +1,15 @@
 [submodule "examples/swap/deps/serum-dex"]
-	path = examples/swap/deps/serum-dex
+	path = tests/swap/deps/serum-dex
 	url = https://github.com/project-serum/serum-dex
 [submodule "examples/cfo/deps/serum-dex"]
-	path = examples/cfo/deps/serum-dex
+	path = tests/cfo/deps/serum-dex
 	url = https://github.com/project-serum/serum-dex
 [submodule "examples/cfo/deps/swap"]
-	path = examples/cfo/deps/swap
+	path = tests/cfo/deps/swap
 	url = https://github.com/project-serum/swap.git
 [submodule "examples/cfo/deps/stake"]
-	path = examples/cfo/deps/stake
+	path = tests/cfo/deps/stake
 	url = https://github.com/project-serum/stake.git
 [submodule "examples/permissioned-markets/deps/serum-dex"]
-	path = examples/permissioned-markets/deps/serum-dex
+	path = tests/permissioned-markets/deps/serum-dex
 	url = https://github.com/project-serum/serum-dex

+ 26 - 26
.travis.yml

@@ -16,7 +16,7 @@ _defaults: &defaults
   - nvm install $NODE_VERSION
   - sudo apt-get install -y pkg-config build-essential libudev-dev
 
-_examples: &examples
+_tests: &tests
   before_install:
   - nvm install $NODE_VERSION
   - npm install -g mocha
@@ -47,35 +47,35 @@ jobs:
         - pushd ts && yarn && popd
         - pushd ts && yarn test && popd
         - pushd ts && yarn lint && popd
-    - <<: *examples
-      name: Runs the examples 1
+    - <<: *tests
+      name: Runs the e2e tests 1
       script:
         - pushd client/example && ./run-test.sh && popd
-        - pushd examples/sysvars && anchor test && popd
-        - pushd examples/composite && anchor test && popd
-        - pushd examples/errors && anchor test && popd
-        - pushd examples/spl/token-proxy && anchor test && popd
-        - pushd examples/multisig && anchor test && popd
-        - pushd examples/interface && anchor test && popd
-        - pushd examples/lockup && anchor test && popd
-        - pushd examples/permissioned-markets/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
-    - <<: *examples
-      name: Runs the examples 2
+        - pushd tests/sysvars && anchor test && popd
+        - pushd tests/composite && anchor test && popd
+        - pushd tests/errors && anchor test && popd
+        - pushd tests/spl/token-proxy && anchor test && popd
+        - pushd tests/multisig && anchor test && popd
+        - pushd tests/interface && anchor test && popd
+        - pushd tests/lockup && anchor test && popd
+        - pushd tests/permissioned-markets/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
+    - <<: *tests
+      name: Runs the e2e tests 2
       script:
-        - pushd examples/misc && anchor test && popd
-        - pushd examples/events && anchor test && popd
-        - pushd examples/cashiers-check && anchor test && popd
-        - pushd examples/typescript && yarn && anchor test && popd
-        - pushd examples/zero-copy && yarn && anchor test && popd
-        - pushd examples/chat && yarn && anchor test && popd
-        - pushd examples/ido-pool && yarn && anchor test && popd
-        - pushd examples/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
-        - pushd examples/cfo && anchor run test-with-build && popd
-    - <<: *examples
-      name: Runs the examples 3
+        - pushd tests/misc && anchor test && popd
+        - pushd tests/events && anchor test && popd
+        - pushd tests/cashiers-check && anchor test && popd
+        - pushd tests/typescript && yarn && anchor test && popd
+        - pushd tests/zero-copy && yarn && anchor test && popd
+        - pushd tests/chat && yarn && anchor test && popd
+        - pushd tests/ido-pool && yarn && anchor test && popd
+        - pushd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test && popd
+        - pushd tests/cfo && anchor run test-with-build && popd
+    - <<: *tests
+      name: Runs the e2e tests 3
       script:
-        - pushd examples/escrow && yarn && anchor test && popd
-        - pushd examples/pyth && yarn && anchor test && popd
+        - pushd tests/escrow && yarn && anchor test && popd
+        - pushd tests/pyth && yarn && anchor test && popd
         - pushd examples/tutorial/basic-0 && anchor test && popd
         - pushd examples/tutorial/basic-1 && anchor test && popd
         - pushd examples/tutorial/basic-2 && anchor test && popd

+ 3 - 3
Cargo.toml

@@ -15,7 +15,7 @@ members = [
     "spl",
 ]
 exclude = [
-    "examples/swap/deps/serum-dex",
-    "examples/cfo/deps/serum-dex",
-    "examples/permissioned-markets/deps/serum-dex",
+    "tests/swap/deps/serum-dex",
+    "tests/cfo/deps/serum-dex",
+    "tests/permissioned-markets/deps/serum-dex",
 ]

+ 2 - 2
client/example/Cargo.toml

@@ -10,8 +10,8 @@ edition = "2018"
 anchor-client = { path = "../" }
 basic-2 = { path = "../../examples/tutorial/basic-2/programs/basic-2", features = ["no-entrypoint"] }
 basic-4 = { path = "../../examples/tutorial/basic-4/programs/basic-4", features = ["no-entrypoint"] }
-composite = { path = "../../examples/composite/programs/composite", features = ["no-entrypoint"] }
-events = { path = "../../examples/events/programs/events", features = ["no-entrypoint"] }
+composite = { path = "../../tests/composite/programs/composite", features = ["no-entrypoint"] }
+events = { path = "../../tests/events/programs/events", features = ["no-entrypoint"] }
 shellexpand = "2.1.0"
 anyhow = "1.0.32"
 rand = "0.7.3"

+ 2 - 2
client/example/run-test.sh

@@ -28,7 +28,7 @@ main() {
     #
     # Deploy programs.
     #
-    pushd ../../examples/composite/
+    pushd ../../tests/composite/
     anchor build
     anchor deploy
     local composite_pid=$(cat target/idl/composite.json | jq -r .metadata.address)
@@ -43,7 +43,7 @@ main() {
     anchor deploy
     local basic_4_pid=$(cat target/idl/basic_4.json | jq -r .metadata.address)
     popd
-    pushd ../../examples/events
+    pushd ../../tests/events
     anchor build
     anchor deploy
     local events_pid=$(cat target/idl/events.json | jq -r .metadata.address)

+ 2 - 3
examples/README.md → tests/README.md

@@ -1,7 +1,6 @@
-# Examples
+# Tests
 
-The examples presented here are for educational purposes only. No program
-here is guaranteed to be safe or secure in any way. In many cases, they are
+No program here is guaranteed to be safe or secure in any way. In most cases, they are
 simply just simple integration tests to illustrate some particular functionality
 of the framework. If used, one should audit any programs used and take full
 responsibility for the consequences that occur due to any outstanding bugs

+ 0 - 0
examples/cashiers-check/Anchor.toml → tests/cashiers-check/Anchor.toml


+ 0 - 0
examples/cashiers-check/Cargo.toml → tests/cashiers-check/Cargo.toml


+ 0 - 0
examples/cashiers-check/migrations/deploy.js → tests/cashiers-check/migrations/deploy.js


+ 0 - 0
examples/cashiers-check/programs/cashiers-check/Cargo.toml → tests/cashiers-check/programs/cashiers-check/Cargo.toml


+ 0 - 0
examples/cashiers-check/programs/cashiers-check/Xargo.toml → tests/cashiers-check/programs/cashiers-check/Xargo.toml


+ 0 - 0
examples/cashiers-check/programs/cashiers-check/src/lib.rs → tests/cashiers-check/programs/cashiers-check/src/lib.rs


+ 0 - 0
examples/cashiers-check/tests/cashiers-check.js → tests/cashiers-check/tests/cashiers-check.js


+ 0 - 0
examples/cfo/Anchor.toml → tests/cfo/Anchor.toml


+ 0 - 0
examples/cfo/Cargo.toml → tests/cfo/Cargo.toml


+ 0 - 0
examples/cfo/deps/serum-dex → tests/cfo/deps/serum-dex


+ 0 - 0
examples/cfo/deps/stake → tests/cfo/deps/stake


+ 0 - 0
examples/cfo/deps/swap → tests/cfo/deps/swap


+ 0 - 0
examples/cfo/migrations/deploy.js → tests/cfo/migrations/deploy.js


+ 0 - 0
examples/cfo/programs/cfo/Cargo.toml → tests/cfo/programs/cfo/Cargo.toml


+ 0 - 0
examples/cfo/programs/cfo/Xargo.toml → tests/cfo/programs/cfo/Xargo.toml


+ 0 - 0
examples/cfo/programs/cfo/src/lib.rs → tests/cfo/programs/cfo/src/lib.rs


+ 0 - 0
examples/cfo/scripts/common.sh → tests/cfo/scripts/common.sh


+ 0 - 0
examples/cfo/scripts/fees.js → tests/cfo/scripts/fees.js


+ 0 - 0
examples/cfo/scripts/list-market.js → tests/cfo/scripts/list-market.js


+ 0 - 0
examples/cfo/scripts/localnet.sh → tests/cfo/scripts/localnet.sh


+ 0 - 0
examples/cfo/scripts/market-maker.json → tests/cfo/scripts/market-maker.json


+ 0 - 0
examples/cfo/scripts/trade-bot.js → tests/cfo/scripts/trade-bot.js


+ 0 - 0
examples/cfo/tests/cfo.js → tests/cfo/tests/cfo.js


+ 0 - 0
examples/cfo/tests/utils/index.js → tests/cfo/tests/utils/index.js


+ 0 - 0
examples/cfo/tests/utils/stake.js → tests/cfo/tests/utils/stake.js


+ 0 - 0
examples/chat/Anchor.toml → tests/chat/Anchor.toml


+ 0 - 0
examples/chat/Cargo.toml → tests/chat/Cargo.toml


+ 0 - 0
examples/chat/migrations/deploy.js → tests/chat/migrations/deploy.js


+ 0 - 0
examples/chat/programs/chat/Cargo.toml → tests/chat/programs/chat/Cargo.toml


+ 0 - 0
examples/chat/programs/chat/Xargo.toml → tests/chat/programs/chat/Xargo.toml


+ 0 - 0
examples/chat/programs/chat/src/lib.rs → tests/chat/programs/chat/src/lib.rs


+ 0 - 0
examples/chat/tests/chat.js → tests/chat/tests/chat.js


+ 0 - 0
examples/composite/Anchor.toml → tests/composite/Anchor.toml


+ 0 - 0
examples/composite/Cargo.toml → tests/composite/Cargo.toml


+ 0 - 0
examples/composite/programs/composite/Cargo.toml → tests/composite/programs/composite/Cargo.toml


+ 0 - 0
examples/composite/programs/composite/Xargo.toml → tests/composite/programs/composite/Xargo.toml


+ 0 - 0
examples/composite/programs/composite/src/lib.rs → tests/composite/programs/composite/src/lib.rs


+ 0 - 0
examples/composite/tests/composite.js → tests/composite/tests/composite.js


+ 0 - 0
examples/errors/Anchor.toml → tests/errors/Anchor.toml


+ 0 - 0
examples/errors/Cargo.toml → tests/errors/Cargo.toml


+ 0 - 0
examples/errors/programs/errors/Cargo.toml → tests/errors/programs/errors/Cargo.toml


+ 0 - 0
examples/errors/programs/errors/Xargo.toml → tests/errors/programs/errors/Xargo.toml


+ 0 - 0
examples/errors/programs/errors/src/lib.rs → tests/errors/programs/errors/src/lib.rs


+ 0 - 0
examples/errors/tests/errors.js → tests/errors/tests/errors.js


+ 0 - 0
examples/escrow/Anchor.toml → tests/escrow/Anchor.toml


+ 0 - 0
examples/escrow/Cargo.toml → tests/escrow/Cargo.toml


+ 0 - 0
examples/escrow/package.json → tests/escrow/package.json


+ 0 - 0
examples/escrow/programs/escrow/Cargo.toml → tests/escrow/programs/escrow/Cargo.toml


+ 0 - 0
examples/escrow/programs/escrow/Xargo.toml → tests/escrow/programs/escrow/Xargo.toml


+ 0 - 0
examples/escrow/programs/escrow/src/lib.rs → tests/escrow/programs/escrow/src/lib.rs


+ 0 - 0
examples/escrow/tests/escrow.js → tests/escrow/tests/escrow.js


+ 0 - 0
examples/events/Anchor.toml → tests/events/Anchor.toml


+ 0 - 0
examples/events/Cargo.toml → tests/events/Cargo.toml


+ 0 - 0
examples/events/migrations/deploy.js → tests/events/migrations/deploy.js


+ 0 - 0
examples/events/programs/events/Cargo.toml → tests/events/programs/events/Cargo.toml


+ 0 - 0
examples/events/programs/events/Xargo.toml → tests/events/programs/events/Xargo.toml


+ 0 - 0
examples/events/programs/events/src/lib.rs → tests/events/programs/events/src/lib.rs


+ 0 - 0
examples/events/tests/events.js → tests/events/tests/events.js


+ 0 - 0
examples/ido-pool/Anchor.toml → tests/ido-pool/Anchor.toml


+ 0 - 0
examples/ido-pool/Cargo.toml → tests/ido-pool/Cargo.toml


+ 0 - 0
examples/ido-pool/migrations/deploy.js → tests/ido-pool/migrations/deploy.js


+ 0 - 0
examples/ido-pool/programs/ido-pool/Cargo.toml → tests/ido-pool/programs/ido-pool/Cargo.toml


+ 0 - 0
examples/ido-pool/programs/ido-pool/Xargo.toml → tests/ido-pool/programs/ido-pool/Xargo.toml


+ 0 - 0
examples/ido-pool/programs/ido-pool/src/lib.rs → tests/ido-pool/programs/ido-pool/src/lib.rs


+ 0 - 0
examples/ido-pool/tests/ido-pool.js → tests/ido-pool/tests/ido-pool.js


+ 0 - 0
examples/ido-pool/tests/utils/index.js → tests/ido-pool/tests/utils/index.js


+ 0 - 0
examples/interface/Anchor.toml → tests/interface/Anchor.toml


+ 0 - 0
examples/interface/Cargo.toml → tests/interface/Cargo.toml


+ 0 - 0
examples/interface/programs/counter-auth/Cargo.toml → tests/interface/programs/counter-auth/Cargo.toml


+ 0 - 0
examples/interface/programs/counter-auth/Xargo.toml → tests/interface/programs/counter-auth/Xargo.toml


+ 0 - 0
examples/interface/programs/counter-auth/src/lib.rs → tests/interface/programs/counter-auth/src/lib.rs


+ 0 - 0
examples/interface/programs/counter/Cargo.toml → tests/interface/programs/counter/Cargo.toml


+ 0 - 0
examples/interface/programs/counter/Xargo.toml → tests/interface/programs/counter/Xargo.toml


+ 0 - 0
examples/interface/programs/counter/src/lib.rs → tests/interface/programs/counter/src/lib.rs


+ 0 - 0
examples/interface/tests/interface.js → tests/interface/tests/interface.js


+ 0 - 0
examples/lockup/Anchor.toml → tests/lockup/Anchor.toml


+ 0 - 0
examples/lockup/Cargo.toml → tests/lockup/Cargo.toml


+ 0 - 0
examples/lockup/docs/lockups.md → tests/lockup/docs/lockups.md


+ 0 - 0
examples/lockup/docs/staking.md → tests/lockup/docs/staking.md


+ 0 - 0
examples/lockup/migrations/deploy.js → tests/lockup/migrations/deploy.js


+ 0 - 0
examples/lockup/programs/lockup/Cargo.toml → tests/lockup/programs/lockup/Cargo.toml


+ 0 - 0
examples/lockup/programs/lockup/Xargo.toml → tests/lockup/programs/lockup/Xargo.toml


+ 0 - 0
examples/lockup/programs/lockup/src/calculator.rs → tests/lockup/programs/lockup/src/calculator.rs


+ 0 - 0
examples/lockup/programs/lockup/src/lib.rs → tests/lockup/programs/lockup/src/lib.rs


+ 0 - 0
examples/lockup/programs/registry/Cargo.toml → tests/lockup/programs/registry/Cargo.toml


+ 0 - 0
examples/lockup/programs/registry/Xargo.toml → tests/lockup/programs/registry/Xargo.toml


+ 0 - 0
examples/lockup/programs/registry/src/lib.rs → tests/lockup/programs/registry/src/lib.rs


+ 0 - 0
examples/lockup/tests/lockup.js → tests/lockup/tests/lockup.js


+ 0 - 0
examples/lockup/tests/utils.js → tests/lockup/tests/utils.js


+ 0 - 0
examples/misc/Anchor.toml → tests/misc/Anchor.toml


+ 0 - 0
examples/misc/Cargo.toml → tests/misc/Cargo.toml


+ 0 - 0
examples/misc/migrations/deploy.js → tests/misc/migrations/deploy.js


+ 0 - 0
examples/misc/package.json → tests/misc/package.json


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott